-
Notifications
You must be signed in to change notification settings - Fork 132
64 lines (61 loc) · 1.83 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
53
54
55
56
57
58
59
60
61
62
63
64
name: GitHub Action Slack Notify CI
on:
- push
- pull_request
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Use Node.js v16.x
uses: actions/setup-node@v1
with:
node-version: 16
- 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
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: yarn install and test
run: |
yarn
yarn test
env:
CI: true
- name: yarn build
run: yarn build
- name: release
if: ${{ endsWith(github.ref, '/main') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release
- name: update v1 tag
if: ${{ endsWith(github.ref, '/main') }}
run: 'git push -f https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git HEAD:refs/heads/v1'
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