-
-
Notifications
You must be signed in to change notification settings - Fork 2
57 lines (49 loc) · 1.57 KB
/
version-or-publish.yml
File metadata and controls
57 lines (49 loc) · 1.57 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
name: Version or Publish
on:
workflow_run:
workflows: ["Builds, tests & co"]
types: [completed]
concurrency: ${{ github.workflow }}
permissions: read-all
jobs:
release:
if: ${{ github.event.workflow_run.head_branch == 'master' && github.event.workflow_run.conclusion == 'success' }}
permissions:
contents: write # to create release
id-token: write # to generate provenance
issues: write # to post issue comments
pull-requests: write # to create pull request
runs-on: ubuntu-latest
steps:
- name: Checkout tree
uses: actions/checkout@v4
- name: Set-up Node.js
uses: actions/setup-node@v4
with:
check-latest: true
node-version-file: .nvmrc
- run: corepack enable
- run: pnpm i
- name: Get latest tag before changeset
id: before-tag
continue-on-error: false
run: |
git fetch --tags
tag=$(git for-each-ref --sort=-creatordate --format '%(refname:short)' refs/tags | head -n 1)
if [ -z "$tag" ]; then
echo "last_tag=" >> $GITHUB_OUTPUT
else
echo "last_tag=$tag" >> $GITHUB_OUTPUT
fi
- name: Create Release Pull Request
uses: changesets/action@v1
continue-on-error: false
id: pub-or-release-pr
with:
version: pnpm changeset version
publish: pnpm pub
env:
CI: true
GITHUB_TOKEN: ${{ github.token }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}