-
Notifications
You must be signed in to change notification settings - Fork 2
60 lines (57 loc) · 1.97 KB
/
Copy pathci.yml
File metadata and controls
60 lines (57 loc) · 1.97 KB
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
name: CI
on:
push:
branches: ["**"]
pull_request:
branches: [main, master]
jobs:
test:
if: github.event_name != 'push' || !contains(github.event.head_commit.message, '[skip ci]')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- uses: pnpm/action-setup@v4
with:
version: latest
- run: pnpm install --frozen-lockfile
- run: pnpm test
release:
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') && github.actor != 'github-actions[bot]' && !contains(github.event.head_commit.message, '[skip ci]')
needs: test
runs-on: ubuntu-latest
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://registry.npmjs.org
- uses: pnpm/action-setup@v4
with:
version: latest
- run: pnpm install --frozen-lockfile
- name: Bump patch version
id: version
run: |
NEW_VERSION="$(npm version patch --no-git-tag-version)"
echo "new_version=${NEW_VERSION#v}" >> "$GITHUB_OUTPUT"
- name: Publish package
run: pnpm publish --provenance --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Commit release back to repository
run: |
git add package.json package-lock.json
git -c user.name='github-actions[bot]' -c user.email='41898282+github-actions[bot]@users.noreply.github.com' commit -m "chore: release v${{ steps.version.outputs.new_version }} [skip ci]"
git tag "v${{ steps.version.outputs.new_version }}"
git push origin HEAD:${GITHUB_REF_NAME} --follow-tags