-
Notifications
You must be signed in to change notification settings - Fork 64
99 lines (81 loc) · 2.62 KB
/
generate-release-tag.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Generate Release Tag
on:
repository_dispatch:
types: [create-release-tag]
jobs:
testing:
runs-on: ubuntu-latest
strategy:
matrix:
node:
- "18.0"
- "19.0"
- "20.0"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Print node version
run: node -v
- name: Install dependencies
run: npm install
- name: Linting
run: npm run lint
- name: Testing
run: DEVELOPMENT_API_KEY=${{ secrets.DEVELOPMENT_API_KEY }} BUSINESS_ID=${{ secrets.BUSINESS_ID }} npm run test
send-test-result:
name: Slack Notification
needs: [testing]
if: always() && (needs.testing.result == 'success' || needs.testing.result == 'failure')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set Slack Color
id: set_color
run: |
if [ "${{ needs.testing.result }}" == "success" ]; then
echo "color=good" >> $GITHUB_ENV
else
echo "color=danger" >> $GITHUB_ENV
fi
- name: Send Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_TITLE: "[xendi-node] CI pipeline for ${{ github.event.client_payload.version }}"
SLACK_MESSAGE: 'Test Result: ${{ needs.testing.result }}'
SLACK_COLOR: ${{ steps.set_color.outputs.color }}
publish:
runs-on: ubuntu-latest
needs: [testing]
steps:
- uses: actions/checkout@v4
- name: Set the value in bash
id: parse-changelog
run: |
echo "changelog<<EOF" >> "$GITHUB_OUTPUT"
echo "${{ github.event.client_payload.changelog }}" | sed -e 's/%0A/\n/g' >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- name: Create Release
id: create-release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
with:
tag_name: ${{ github.event.client_payload.version }}
release_name: ${{ github.event.client_payload.version }}
body: ${{ steps.parse-changelog.outputs.changelog }}
draft: false
prerelease: false
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
registry-url: 'https://registry.npmjs.org'
- run: npm i
- run: npm run custom-publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}