-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (81 loc) · 2.58 KB
/
cd.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: CD
on:
push:
branches: [master]
concurrency:
group: deploy
cancel-in-progress: true
jobs:
build:
name: Build
runs-on: ubuntu-latest
outputs:
artifact-name: ${{ steps.build.outputs.artifact-name }}
artifact-path: ${{ steps.build.outputs.artifact-path }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build
id: build
uses: andrewscwei/actions/node-build@v1
with:
artifact-path: build/
deploy:
name: Deploy
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
cache: npm
node-version-file: .node-version
- name: Install Node modules
run: npm install
- name: Deploy to GitHub pages
uses: andrewscwei/actions/gh-pages-deploy@v1
with:
artifact-name: ${{ needs.build.outputs.artifact-name }}
artifact-path: ${{ needs.build.outputs.artifact-path }}
predeploy-command: npm run pages
release:
name: Release
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: ${{ needs.build.outputs.artifact-name }}
path: ${{ needs.build.outputs.artifact-path }}
- name: Set up Node
uses: actions/setup-node@v4
with:
cache: npm
node-version-file: .node-version
- name: Install Node modules
run: npm install
- name: Create release
env:
GIT_AUTHOR_NAME: github-actions[bot]
GIT_AUTHOR_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
GIT_COMMITTER_NAME: github-actions[bot]
GIT_COMMITTER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_AUTH }}
run: npx semantic-release
notify:
name: Notify
needs: [build, deploy, release]
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- uses: andrewscwei/telegram-action@v1
with:
success: ${{ needs.build.result == 'success' && needs.deploy.result == 'success' && needs.release.result == 'success' }}
cancelled: ${{ needs.build.result == 'cancelled' || needs.deploy.result == 'cancelled' || needs.release.result == 'cancelled' }}
bot-token: ${{ secrets.TELEGRAM_DEVOPS_BOT_TOKEN }}
chat-id: ${{ secrets.TELEGRAM_DEVOPS_CHAT_ID }}