-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
215 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{ | ||
"attachments": [ | ||
{ | ||
"color": "#008000", | ||
"blocks": [ | ||
{ | ||
"type": "header", | ||
"text": { | ||
"type": "plain_text", | ||
"text": "New Release Created in: ${{ env.REPOSITORY_NAME }}", | ||
"emoji": true | ||
} | ||
}, | ||
{ | ||
"type": "divider" | ||
}, | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": "*Version*: ${{ env.version }}" | ||
} | ||
}, | ||
{ | ||
"type": "actions", | ||
"elements": [ | ||
{ | ||
"type": "button", | ||
"text": { | ||
"type": "plain_text", | ||
"text": "View Release", | ||
"emoji": true | ||
}, | ||
"value": "click_me_123", | ||
"url": "${{ env.RELEASE_URL }}", | ||
"action_id": "button-action" | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "divider" | ||
}, | ||
{ | ||
"type": "context", | ||
"elements": [ | ||
{ | ||
"type": "image", | ||
"image_url": "https://www.editorialoffice.co.uk/wp-content/uploads/2021/05/Red-Icon-Squares-new-white-person-tick.jpg", | ||
"alt_text": "author" | ||
}, | ||
{ | ||
"type": "mrkdwn", | ||
"text": "*Author:* ${{ env.AUTHOR }}" | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "context", | ||
"elements": [ | ||
{ | ||
"type": "image", | ||
"image_url": "https://technicaeditorial.com/wordpress/wp-content/uploads/2021/04/peer-review-1.png", | ||
"alt_text": "reviewers" | ||
}, | ||
{ | ||
"type": "mrkdwn", | ||
"text": "*Reviewers:* ${{ env.REVIEWERS}}" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
name: Create Release on PR | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
|
||
env: | ||
REGISTRY: docker.io | ||
IMAGE_NAME: samacommunity/sama-push-queue-board | ||
|
||
jobs: | ||
create-release: | ||
if: | | ||
contains(github.event.pull_request.title, 'release') == true && | ||
github.event.pull_request.merged == true && | ||
github.event.pull_request.base.ref == 'main' | ||
runs-on: self-hosted | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Extract Version | ||
id: extract-version | ||
run: | | ||
# Use grep to find the first occurrence of the version number matching "## 0.0.0" pattern | ||
version=$(grep -m 1 -oP '## \d+\.\d+\.\d+' CHANGELOG.md | cut -d ' ' -f 2) | ||
echo "version=$version" >> $GITHUB_ENV | ||
- name: Extract Changelog | ||
id: extract-changelog | ||
run: | | ||
# Extract the content between the last two version headers | ||
changelog=$(awk '/^## [0-9]+\.[0-9]+\.[0-9]+/{if (!version) {version=$0; next}} /^## [0-9]+\.[0-9]+\.[0-9]+/{exit} {if (version) description = description ORS $0} END {if (version) print description}' CHANGELOG.md | sed -e '/^## [0-9]+\.[0-9]+\.[0-9]+/d; s/^# //' > changelog.txt) | ||
echo "changelog_file=changelog.txt" >> $GITHUB_ENV | ||
- name: Create Release | ||
id: create-release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ env.version }} | ||
release_name: ${{ env.version }} | ||
body_path: ${{ env.changelog_file }} | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Post to a Slack channel | ||
if: success() | ||
id: slack | ||
uses: slackapi/[email protected] | ||
env: | ||
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | ||
REPOSITORY_NAME: ${{ github.repository }} | ||
AUTHOR: ${{ github.event.pull_request.user.login }} | ||
REVIEWERS: ${{ join(github.event.pull_request.requested_reviewers.*.login, ', ') }} | ||
RELEASE_URL: ${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ env.version }} | ||
with: | ||
# You can pass in multiple channels to post to by providing a comma-delimited list of channel IDs. | ||
channel-id: 'git-releases' | ||
payload-file-path: "./.github/slack/payload-slack-content.json" | ||
|
||
push_to_registry: | ||
if: | | ||
contains(github.event.pull_request.title, 'release') == true && | ||
github.event.pull_request.merged == true && | ||
github.event.pull_request.base.ref == 'main' | ||
needs: [create-release] | ||
|
||
runs-on: self-hosted | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Extract Version | ||
id: extract-version | ||
run: | | ||
# Use grep to find the first occurrence of the version number matching "## 0.0.0" pattern | ||
version=$(grep -m 1 -oP '## \d+\.\d+\.\d+' CHANGELOG.md | cut -d ' ' -f 2) | ||
echo "version=$version" >> $GITHUB_ENV | ||
- name: Set tag based on version | ||
id: set_tag | ||
run: | | ||
echo "IMAGE_TAG=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.version }}" >> $GITHUB_ENV | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: "{{defaultContext}}" | ||
push: true | ||
tags: ${{ env.IMAGE_TAG }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: linux/amd64,linux/arm64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Changelog | ||
|
||
## 0.0.1 (Example) | ||
|
||
### Important Notes | ||
|
||
- **Important**: Removed something | ||
- **Important**: Updated something | ||
- App now requires something | ||
|
||
### Maintenance | ||
|
||
- Removed a redundant feature | ||
- Added a new functionality | ||
- Improved overall performance | ||
- Enhanced user interface responsiveness | ||
|
||
### Docker | ||
|
||
- Added `Dockerfile` | ||
|
||
### Features | ||
|
||
- :tada: Implemented a new feature | ||
- This feature allows users to... | ||
- Added a user profile customization option | ||
|
||
### Bug Fixes | ||
|
||
- Fixed a critical issue that caused... |