ci: added dependabot config (#74) #50
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
name: Deploy git tag | |
# Only run after a pull request has been merged. This is because | |
# bot account runs write operations on the github repo to push a tag. | |
on: | |
push: | |
branches: [main] | |
permissions: | |
contents: write # access to push the git tag | |
issues: write # Bot creates an issue if there is an issue during deployment process | |
pull-requests: write # allow bot to make comments on PRs after they get deployed | |
jobs: | |
deploy-git-tag: | |
name: Deploy git tag | |
runs-on: ubuntu-latest | |
outputs: | |
new_release_git_head: ${{ steps.semantic-release.outputs.new_release_git_head }} | |
new_release_published: ${{ steps.semantic-release.outputs.new_release_published }} | |
new_release_version: ${{ steps.semantic-release.outputs.new_release_version }} | |
steps: | |
- uses: actions/checkout@v3 | |
# CLI to replace strings in files. The CLI recommends using `cargo install` which is slow. This Action is fast because it downloads pre-built binaries. | |
# If using sd on macos, "brew install" works great. for Linux, this is the recommended way. | |
- name: Install sd CLI to use later in the workflow | |
uses: kenji-miyake/setup-sd@v1 | |
- name: Deploy git tag via semantic release | |
uses: cycjimmy/semantic-release-action@v3 | |
id: semantic-release | |
with: | |
# version numbers below can be in many forms: M, M.m, M.m.p | |
semantic_version: 19 | |
extra_plugins: | | |
conventional-changelog-conventionalcommits@4 | |
@semantic-release/changelog@6 | |
@semantic-release/git@10 | |
@semantic-release/github@8 | |
@semantic-release/exec@6 | |
env: | |
# Needs to push git commits to repo. Needs write access. | |
GITHUB_TOKEN: ${{ secrets.WRITE_ACCESS_BOT_TOKEN }} | |
- name: Notify team of git tag being created | |
uses: slackapi/[email protected] | |
if: steps.semantic-release.outputs.new_release_published == 'true' | |
with: | |
# Use block kit to format the Slack message: https://app.slack.com/block-kit-builder | |
payload: | | |
{ | |
"text": "Flutter SDK git tag created", | |
"username": "Flutter deployment bot", | |
"icon_url": "https://img.icons8.com/color/512/flutter.png", | |
"channel": "#mobile-deployments", | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "*Flutter* SDK git tag created successfully! (deployment step 1 of 2)" | |
} | |
}, | |
{ | |
"type": "divider" | |
}, | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "*Version ${{ steps.semantic-release.outputs.new_release_version }}*\n\nFlutter SDK deployment progress:\n ~1. <https://github.com/${{github.repository}}/releases/tag/${{steps.semantic-release.outputs.new_release_version}}|create git tag>~\n2. deploy to pub.dev\n\n" | |
} | |
} | |
] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | |
- name: Notify team of failure | |
uses: slackapi/[email protected] | |
if: ${{ failure() }} # only run this if any previous step failed | |
with: | |
# Use block kit to format the Slack message: https://app.slack.com/block-kit-builder | |
payload: | | |
{ | |
"text": "Flutter SDK deployment failure", | |
"username": "Flutter deployment bot", | |
"icon_url": "https://img.icons8.com/color/512/flutter.png", | |
"channel": "#mobile-deployments", | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "*Flutter* SDK deployment :warning: failure :warning:" | |
} | |
}, | |
{ | |
"type": "divider" | |
}, | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "Flutter SDK failed deployment during step *create git tag*. View <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}|CI server logs> to learn why and fix the issue. <https://github.com/customerio/mobile/blob/main/GIT-WORKFLOW.md|Learn more about the deployment process and how to fix errors>." | |
} | |
} | |
] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK |