Repository navigation
126 lines (111 loc) · 3.78 KB
/
Copy pathrelease.yml
File metadata and controls
126 lines (111 loc) · 3.78 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
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
124
125
126
name: Release
on:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: release-main
cancel-in-progress: false
jobs:
policy:
name: Release policy
runs-on: ubuntu-latest
timeout-minutes: 2
permissions: {}
steps:
- name: Require addon-stack main
shell: bash
env:
RELEASE_REF: ${{ github.ref }}
RELEASE_REPOSITORY: ${{ github.repository }}
run: |
test "$RELEASE_REF" = "refs/heads/main"
test "$RELEASE_REPOSITORY" = "addon-stack/addon-bone-plugins"
release:
name: Release and publish
needs: policy
runs-on: ubuntu-latest
timeout-minutes: 30
environment:
name: release
permissions:
contents: read
id-token: write
steps:
- name: Create repository-scoped release App token
id: release-app-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
app-id: ${{ vars.RELEASE_APP_ID }}
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
permission-contents: write
- name: Checkout release commit
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.sha }}
fetch-depth: 0
fetch-tags: true
token: ${{ steps.release-app-token.outputs.token }}
persist-credentials: true
- name: Verify current main and prepare branch
shell: bash
env:
RELEASE_SHA: ${{ github.sha }}
run: |
set -euo pipefail
remote_main="$(git ls-remote --exit-code origin refs/heads/main | cut -f1)"
test "$(git rev-parse HEAD)" = "$RELEASE_SHA"
test "$remote_main" = "$RELEASE_SHA"
test -z "$(git status --porcelain)"
git switch --force-create main "$RELEASE_SHA"
git branch --set-upstream-to=origin/main main
- name: Set up pnpm and Node.js
uses: pnpm/setup@703c52620218391530e48b9e8870d5c0082e1b9b # v2.1.0
with:
runtime: node@24
cache: false
install: false
- name: Install Trusted Publishing-compatible npm
shell: bash
run: |
set -euo pipefail
npm install --global --prefix "$RUNNER_TEMP/npm-cli" npm@11.19.1
echo "$RUNNER_TEMP/npm-cli/bin" >> "$GITHUB_PATH"
- name: Verify publish toolchain
shell: bash
run: |
set -euo pipefail
pnpm --version
node --version
npm_path="$(command -v npm)"
npm_version="$(npm --version)"
echo "npm path: $npm_path"
echo "npm $npm_version"
test "$npm_path" = "$RUNNER_TEMP/npm-cli/bin/npm"
node -e 'const [major = 0, minor = 0, patch = 0] = process.argv[1].split(".").map(Number); if (major < 11 || (major === 11 && (minor < 5 || (minor === 5 && patch < 1)))) process.exit(1)' "$npm_version"
- name: Install dependencies
run: pnpm install --frozen-lockfile
env:
CI: "true"
HUSKY: "0"
- name: Verify workspace
run: pnpm verify
env:
CI: "true"
- name: Configure release author
shell: bash
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Version, changelog, tag, and push
run: pnpm exec nx release --skip-publish
env:
CI: "true"
GITHUB_TOKEN: ${{ steps.release-app-token.outputs.token }}
HUSKY: "0"
- name: Publish current package versions with OIDC
run: pnpm exec nx release publish
env:
CI: "true"
PNPM_CONFIG_PROVENANCE: "true"
NPM_CONFIG_PROVENANCE: "true"