Merge pull request #83 from deriv-com/niloofar/FEQ-1692/slack-notific… #96
Workflow file for this run
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: Release | |
on: | |
push: | |
branches: | |
- main | |
- beta | |
- next | |
- '^([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*|x)' | |
permissions: | |
contents: read # for checkout | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # to be able to publish a GitHub release | |
issues: write # to be able to comment on released issues | |
pull-requests: write # to be able to comment on released pull requests | |
id-token: write # to enable use of OIDC for npm provenance | |
outputs: | |
RELEASE_VERSION: ${{ steps.extract_version.outputs.RELEASE_VERSION }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.CI_GITHUB_TOKEN }} | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 'lts/*' | |
- name: Install dependencies | |
run: npm clean-install | |
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies | |
if: success() | |
run: npm audit signatures | |
- name: Release | |
if: success() | |
env: | |
CI: true | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN}} | |
run: npx semantic-release | |
- name: Extract version | |
id: extract_version | |
run: | | |
export NEXT_TAG_VERSION=$(npx semantic-release --dry-run | grep 'The next release version is' | sed -E 's/.* ([[:digit:].]+)$/\1/') | |
echo "RELEASE_VERSION=${NEXT_TAG_VERSION}" >> $GITHUB_OUTPUT | |
- name: Trigger Quill Icons Park release | |
if: success() | |
env: | |
QUILL_ICONS_PARK_WORK_FLOW_FILE: 'pr_to_inform_quill_icons_update.yaml' | |
run: | | |
curl \ | |
-X POST \ | |
-H "Authorization: token ${{ secrets.CI_GITHUB_TOKEN }}" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
https://api.github.com/repos/${{github.repository}}/actions/workflows/${{env.QUILL_ICONS_PARK_WORK_FLOW_FILE}}/dispatches \ | |
-d '{"ref":"main"}' | |
send_slack_notification: | |
name: Send Release Slack notification | |
runs-on: ubuntu-latest | |
if: always() | |
needs: [release] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
- name: Conclusion | |
uses: technote-space/workflow-conclusion-action@45ce8e0eb155657ab8ccf346ade734257fd196a5 | |
- name: Create Slack Message | |
id: create_slack_message | |
run: | | |
if [ "${{ env.WORKFLOW_CONCLUSION }}" == "success" ]; then | |
echo "MESSAGE=${{ env.RELEASE_TYPE }} Release succeeded for @deriv/quill-icons with version ${{ needs.release.outputs.RELEASE_VERSION }} 🥳🤩" >> $GITHUB_OUTPUT | |
else | |
echo "MESSAGE=${{ env.RELEASE_TYPE }} Release failed for @deriv/quill-icons with version ${{ needs.release.outputs.RELEASE_VERSION }} 🤨🥸" >> $GITHUB_OUTPUT | |
fi | |
- name: Send Slack Notification | |
uses: './.github/actions/send_slack_notifications' | |
with: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
MESSAGE: ${{ steps.create_slack_message.outputs.MESSAGE }} |