Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add release success and improved fail slack message #2777

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 96 additions & 2 deletions .github/workflows/dhis2-verify-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:

lint:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'chore(release)')"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand All @@ -62,6 +63,7 @@ jobs:

test:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'chore(release)')"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand All @@ -83,6 +85,7 @@ jobs:

call-workflow-e2e-prod:
needs: [build, lint, test]
if: "!contains(github.event.head_commit.message, 'chore(release)')"
uses: dhis2/workflows/.github/workflows/analytics-e2e-tests.yml@master
secrets:
baseurl: ${{ secrets.CYPRESS_DHIS2_BASE_URL_DEV }}
Expand All @@ -99,7 +102,44 @@ jobs:
if: |
!github.event.push.repository.fork &&
github.actor != 'dependabot[bot]' &&
github.event_name != 'pull_request'
github.event_name != 'pull_request' &&
"!contains(github.event.head_commit.message, 'chore(release)')"
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.DHIS2_BOT_GITHUB_TOKEN }}

- uses: actions/setup-node@v3
with:
node-version: 18.x

- uses: actions/download-artifact@v3
with:
name: app-build

- name: Install
run: yarn install --frozen-lockfile

- uses: dhis2/action-semantic-release@master
with:
publish-apphub: true
publish-github: true
github-token: ${{ secrets.DHIS2_BOT_GITHUB_TOKEN }}
apphub-token: ${{ secrets.DHIS2_BOT_APPHUB_TOKEN }}

- uses: dhis2/deploy-build@master
with:
build-dir: build/app
github-token: ${{ secrets.DHIS2_BOT_GITHUB_TOKEN }}

tag:
runs-on: ubuntu-latest
needs: build
if: |
!github.event.push.repository.fork &&
github.actor != 'dependabot[bot]' &&
github.event_name != 'pull_request' &&
contains(github.event.head_commit.message, 'chore(release)')
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -136,11 +176,65 @@ jobs:
!cancelled() &&
github.ref == 'refs/heads/master'
steps:
- name: Checkout code
uses: actions/checkout@master

- name: Extract version
id: extract_version
uses: Saionaro/[email protected]

- name: Send failure message to analytics-internal-bot slack channel
id: slack
uses: slackapi/[email protected]
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
slack-message: ':small_red_triangle_down: Data-visualizer-app release <https://github.com/dhis2/data-visualizer-app/actions/workflows/dhis2-verify-app.yml?query=branch%3Amaster+is%3Afailure>'
payload: |
{
"text": ":small_red_triangle_down: :data-visualizer-app: Data Visualizer version ${{ steps.extract_version.outputs.version }} release <https://github.com/dhis2/data-visualizer-app/actions/workflows/dhis2-verify-app.yml?query=branch%3Amaster+is%3Afailure|failed>",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":small_red_triangle_down: :data-visualizer-app: Data Visualizer version ${{ steps.extract_version.outputs.version }} release <https://github.com/dhis2/data-visualizer-app/actions/workflows/dhis2-verify-app.yml?query=branch%3Amaster+is%3Afailure|failed>"
}
}
]
}

report-release-success:
runs-on: ubuntu-latest
needs: tag
if: |
success() &&
!cancelled() &&
github.ref == 'refs/heads/master' &&
contains(github.event.head_commit.message, 'chore(release)')
steps:
- name: Checkout code
uses: actions/checkout@master

- name: Extract version
id: extract_version
uses: Saionaro/[email protected]

- name: Send success message to analytics-internal-bot slack channel
id: slack
uses: slackapi/[email protected]
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
payload: |
{
"text": ":large_green_circle: :data-visualizer-app: :tada: Data Visualizer app release succeeded for version: ${{ steps.extract_version.outputs.version }}",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":large_green_circle: :data-visualizer-app: :tada: Data Visualizer version ${{ steps.extract_version.outputs.version }} released <https://github.com/dhis2/data-visualizer-app/actions/workflows/dhis2-verify-app.yml?query=branch%3Amaster+is%3Asuccess|successfully>"
}
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
Loading