-
Notifications
You must be signed in to change notification settings - Fork 71
130 lines (108 loc) · 3.28 KB
/
create-version.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Create version
on:
push:
branches:
- 'main'
- 'dev'
tags-ignore:
- '**'
paths-ignore:
- '**/CHANGELOG.md'
- '**/package.json'
- '**/yarn.lock'
pull_request:
workflow_dispatch:
env:
STX_NETWORK: testnet
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Add required Linux dependencies
uses: ./.github/actions/linux-deps
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Cache node_modules
id: cache
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
${{ runner.os }}-yarn
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
yarn
yarn add -ED @actions/core
- name: Lint code
run: yarn check:lint
- name: Check exact versions
uses: ./.github/actions/check-version-lock
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Add required Linux dependencies
uses: ./.github/actions/linux-deps
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Cache node_modules
id: cache
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
${{ runner.os }}-yarn
- name: Install packages
uses: nick-invision/retry@v2
if: steps.cache.outputs.cache-hit != 'true'
with:
timeout_seconds: 600
max_attempts: 3
retry_on: error
command: yarn --frozen-lockfile
- name: Build prod
run: yarn build
- name: Run jest
run: yarn test
release:
runs-on: ubuntu-latest
outputs:
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
new_release_version: ${{ steps.semantic.outputs.new_release_version }}
needs:
- lint
- test
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
# When successful, this step creates a version tag, triggering `publish-version.yml`
- name: Semantic Release
uses: cycjimmy/[email protected]
id: semantic
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
with:
extra_plugins: |
@semantic-release/changelog
@semantic-release/git
- name: Create file with release notes
run: echo "${{ steps.semantic.outputs.new_release_notes }}" > release-notes.txt
- run: cat release-notes.txt
- name: Upload release notes
uses: actions/upload-artifact@v2
with:
name: release-notes
path: release-notes.txt