Repository navigation
70 lines (67 loc) · 2.39 KB
/
Copy pathrelease.yml
File metadata and controls
70 lines (67 loc) · 2.39 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
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Release or create version bump
on:
push:
branches: [main]
workflow_dispatch:
jobs:
build:
if: github.repository == 'toss/pull-up' && github.event_name == 'push'
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
pull-requests: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: jdx/mise-action@v3
- run: yarn install --immutable
- name: Create Changesets Pull Request or Publish to NPM
id: changesets
uses: changesets/action@c48e67d110a68bc90ccf1098e9646092baacaa87 # v1.6.0
with:
title: 'chore: version packages'
commit: 'chore: version packages'
version: yarn changeset version
publish: yarn changeset publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_CONFIG_PROVENANCE: true
canary:
name: Publish canary
if: github.repository == 'toss/pull-up' && github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
concurrency:
group: publish-canary
cancel-in-progress: false
permissions:
id-token: write
contents: read
pull-requests: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: jdx/mise-action@v3
- run: yarn install --immutable
- run: yarn lint
- run: yarn format:check
- run: yarn test
- run: yarn typecheck
- name: Create canary version
run: |
yarn changeset version --snapshot canary --snapshot-prerelease-template "{tag}.${GITHUB_RUN_ID}.${GITHUB_RUN_ATTEMPT}"
version=$(node -p "require('./package.json').version")
case "$version" in
*"-canary.${GITHUB_RUN_ID}.${GITHUB_RUN_ATTEMPT}") ;;
*) echo "::error::No canary version was calculated. Add a changeset before publishing."; exit 1 ;;
esac
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish canary to npm
run: npm publish --tag canary --access public
env:
NPM_CONFIG_PROVENANCE: true
- name: Show install command
run: |
version=$(node -p "require('./package.json').version")
printf 'Run this canary:\n\n npx @pull-up/cli@%s --help\n' "$version" >> "$GITHUB_STEP_SUMMARY"