forked from voxmedia/github-action-slack-notify-build
-
Notifications
You must be signed in to change notification settings - Fork 2
52 lines (49 loc) · 1.45 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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