updated github action #2
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: GitHub Action Slack Notify CI | |
on: | |
- push | |
- pull_request | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
cache: "npm" | |
- name: Notify slack | |
# Don't attempt to send Slack notifications on fork PRs which don't have access to secrets | |
if: env.SLACK_BOT_TOKEN | |
id: slack | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
uses: ./ | |
with: | |
channel_id: CB9QT2NNR | |
status: STARTED | |
color: warning | |
- run: npm install | |
env: | |
CI: true | |
- run: npm run build | |
- name: release | |
if: ${{ endsWith(github.ref, '/main') }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: npx semantic-release | |
- name: update v2 tag | |
if: ${{ endsWith(github.ref, '/main') }} | |
run: "git push -f https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git HEAD:refs/heads/v2" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Notify slack success | |
if: env.SLACK_BOT_TOKEN | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
uses: ./ | |
with: | |
message_id: ${{ steps.slack.outputs.message_id }} | |
channel_id: CB9QT2NNR | |
status: SUCCESS | |
color: good |