forked from steven-tey/novel
-
Notifications
You must be signed in to change notification settings - Fork 1
83 lines (70 loc) · 2.14 KB
/
publish.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
name: Publish
defaults:
run:
shell: bash
working-directory: ./packages/core
on:
push:
branches:
- release
jobs:
publish:
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
pull-requests: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- name: Generate a token
id: generate_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://npm.pkg.github.com/
- uses: pnpm/action-setup@v2
with:
version: 8
- name: git config
run: |
git config --global user.name "sheincbot[bot]"
git config --global user.email "${{ secrets.APP_ID }}+sheincbot[bot]@users.noreply.github.com"
- name: Package install
run: pnpm install --frozen-lockfile
- name: Update version
run: pnpm version patch --no-git-tag-version
- name: Get version
id: get_version
run: |
CURRENT_VERSION=$(node -e "console.log(require('./package.json').version)")
echo "version=$CURRENT_VERSION" >> "$GITHUB_OUTPUT"
- name: Commit version
run: |
git switch release
git add .
git commit -m "chore: update version"
git tag v${{ steps.get_version.outputs.version }}
git push origin release --tags
- name: Publish package
run: pnpm run -w release
env:
NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_GITHUB_TOKEN }}
- name: Create release
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG: "v${{ steps.get_version.outputs.version }}"
with:
tag: ${{ env.RELEASE_TAG }}
name: Release ${{ env.RELEASE_TAG }}
version: ${{ env.RELEASE_TAG }}
publish: true