Skip to content

Commit 04e9f48

Browse files
committed
Add release-it.
1 parent eb9bdbf commit 04e9f48

File tree

4 files changed

+3097
-30
lines changed

4 files changed

+3097
-30
lines changed

.github/workflows/release.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: release
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
version:
6+
type: choice
7+
description: Version number to increment
8+
required: true
9+
options:
10+
- patch
11+
- minor
12+
- major
13+
14+
jobs:
15+
release:
16+
env:
17+
CI: true
18+
GITHUB_TOKEN: ${{ secrets.ACTION_GITHUB_TOKEN }}
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v3
22+
with:
23+
fetch-depth: 0 # Need history for changelog generation
24+
- name: Set Node.js lts
25+
uses: actions/setup-node@v3
26+
with:
27+
node-version: lts/*
28+
- run: npm ci
29+
- name: Build
30+
run: npm run build
31+
- name: Package
32+
run: npm run package
33+
# We need to make sure the checked-in `index.js` actually matches what we expect it to be.
34+
- name: Compare the expected and actual dist/ directories
35+
run: |
36+
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
37+
echo "Detected uncommitted changes after build. See status below:"
38+
git diff
39+
exit 1
40+
fi
41+
id: diff
42+
# If index.js was different than expected, upload the expected version as an artifact
43+
- uses: actions/upload-artifact@v3
44+
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
45+
with:
46+
name: dist
47+
path: dist/
48+
- name: test
49+
id: test
50+
if: ${{ always() }}
51+
run: npm run test -- --coverage
52+
- name: lint
53+
if: ${{ always() }}
54+
run: npm run lint
55+
- name: style
56+
if: ${{ always() }}
57+
run: npm run format:check
58+
- name: config git user
59+
run: |
60+
git config --global user.name ${{ secrets.ACTION_GITHUB_USERNAME }};
61+
git config --global user.email ${{ secrets.ACTION_GITHUB_EMAIL }};
62+
- name: perform release
63+
run: |
64+
npm run release -- \
65+
${{ github.event.inputs.version }} \
66+
--ci

.release-it.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"git": {
3+
"changelog": "npx auto-changelog --stdout --commit-limit false --unreleased --template https://raw.githubusercontent.com/release-it/release-it/master/templates/changelog-compact.hbs"
4+
},
5+
"github": {
6+
"release": true
7+
},
8+
"hooks": {
9+
"after:bump": "npx auto-changelog -p"
10+
},
11+
"npm": {
12+
"publish": false
13+
}
14+
}

0 commit comments

Comments
 (0)