-
Notifications
You must be signed in to change notification settings - Fork 2
123 lines (105 loc) · 3.56 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Publish
on:
push:
branches:
- main
paths:
- "**/CHANGELOG.md"
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
publish:
name: Publish
runs-on: ubuntu-latest
# For whatever reason, yaml does not like the full "meta(changelog): Update package versions" string
# So we check this in two parts
if: |
contains(github.event.head_commit.message, 'meta(changelog)')
&& contains(github.event.head_commit.message, 'Update package versions')
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version-file: "package.json"
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 9
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v3
env:
cache-name: cache-codecov-js-bundle-plugin-node-modules
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-
- name: Install dependencies
run: pnpm install
- name: Publish to NPM
uses: changesets/action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
with:
publish: pnpm changeset:publish
createGithubReleases: true
publish_docs:
name: Publish Docs
needs: publish
runs-on: ubuntu-latest
# For whatever reason, yaml does not like the full "meta(changelog): Update package versions" string
# So we check this in two parts
if: |
contains(github.event.head_commit.message, 'meta(changelog)')
&& contains(github.event.head_commit.message, 'Update package versions')
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Import GPG key
id: import-gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.RELEASER_GPG_PRIVATE_KEY }}
git_user_signingkey: true
git_commit_gpgsign: true
git_config_global: true
- name: Setup Git
run: |
echo "machine github.com login x password ${{ secrets.GITHUB_TOKEN }}" > ~/.netrc
git config --global url."https://github.com/".insteadOf "git://github.com/"
git config --global advice.detachedHead false
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version-file: "package.json"
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 9
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v3
env:
cache-name: cache-codecov-js-bundle-plugin-node-modules
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-
- name: Install dependencies
run: pnpm install
- name: Publish new docs
run: node scripts/publish-docs.mjs