-
Notifications
You must be signed in to change notification settings - Fork 8
76 lines (73 loc) · 2.22 KB
/
release.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
name: Release
on:
push:
branches:
- main
pull_request: {}
jobs:
lint-commits:
name: Lint PR commits
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v5
test-release:
name: Dry-run semantic-release
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Checkout branch
# Pretend to semantic-release that the PR result is eligible for
# building releases because --dry-run still filters for configured
# branches.
run: git checkout -b main
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Cache Node packages
uses: actions/cache@v3
with:
path: node_modules
key: release-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
run: npm ci
- name: Dry-run release
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
# We need to convince semantic-release to not pick up some
# configuration from the CI environment by removing the variable that
# is used for CI detection.
run: unset GITHUB_ACTIONS && npx semantic-release --dry-run --ci false
release:
name: Run semantic release
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.RELEASE_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Cache Node packages
uses: actions/cache@v3
with:
path: node_modules
key: release-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
run: npm ci
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
run: npx semantic-release