generated from unplugin/unplugin-starter
-
-
Notifications
You must be signed in to change notification settings - Fork 2
72 lines (66 loc) · 2.38 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
on:
push:
branches:
- main
name: Release
permissions:
contents: write
pull-requests: write
jobs:
release-pr:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
steps:
- uses: google-github-actions/release-please-action@v4
id: release
with:
token: ${{ secrets.RELEASE_PR_TOKEN }}
# Format changelog, workaround for https://github.com/google-github-actions/release-please-action/issues/542
# Taken from https://github.com/remarkablemark/release-please-extra-files-demo/blob/master/.github/workflows/release-please.yml
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.pr }}
with:
token: ${{ secrets.RELEASE_PR_TOKEN }}
fetch-depth: 0
ref: ${{ fromJson(steps.release.outputs.pr).headBranchName }}
- name: Configure Git user
if: ${{ steps.release.outputs.pr }}
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git --no-pager show --name-only
- name: Format CHANGELOG.md
if: ${{ steps.release.outputs.pr }}
run: npx prettier --write CHANGELOG.md .release-please-manifest.json
- name: Commit
if: ${{ steps.release.outputs.pr }}
run: |
git add CHANGELOG.md .release-please-manifest.json
git commit -m 'chore: Format CHANGELOG.md with Prettier' --no-verify
- name: Push changes
if: ${{ steps.release.outputs.pr }}
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.RELEASE_PR_TOKEN }}
branch: ${{ fromJson(steps.release.outputs.pr).headBranchName }}
publish_npm:
name: Publish to npm
runs-on: ubuntu-latest
needs: [release-pr]
if: needs.release-pr.outputs.release_created
steps:
- uses: actions/checkout@v4
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Config npm
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish to npm
run: pnpm publish --access public --no-git-checks