52 lines (46 loc) · 1.52 KB
/
version-or-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
# - changesets will open a PR to bump versions when new changesets are added
# - changesets will publish packages when that PR is merged
# (it's confusing because the same action does two super different things)
name: Format, Version or Publish Packages
on:
workflow_dispatch:
push:
branches:
- main
permissions:
pull-requests: write
concurrency: ${{ github.workflow }}-${{ github.ref }}
env:
CI: true
PNPM_CACHE_FOLDER: .pnpm-store
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
with:
fetch-depth: 0
token: ${{ secrets.TYPESCRIPT_BOT_TOKEN }}
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
- run: pnpm config set store-dir $PNPM_CACHE_FOLDER
- run: pnpm install
- run: pnpm build
- run: pnpm test
- name: format
run: |
pnpm format
if [ -n "`git status -s`" ]; then
git config user.email "typescriptbot@microsoft.com"
git config user.name "TypeScript Bot"
git commit -am "Format"
git push
fi
- uses: changesets/action@aba318e9165b45b7948c60273e0b72fce0a64eb9 # v1.4.7
with:
publish: pnpm ci:publish
env:
GITHUB_TOKEN: ${{ secrets.TYPESCRIPT_BOT_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}