Repository navigation
125 lines (107 loc) · 4.83 KB
/
Copy pathrelease.yml
File metadata and controls
125 lines (107 loc) · 4.83 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
name: release
# Stages workspace packages to npm whose manually-set version is ahead of
# the registry. Versions are never bumped here — a human bumps each package's
# `version` (typically via a release PR); publishing a GitHub release then
# triggers this workflow, which figures out what actually needs staging and
# stages it in dependency order. See scripts/release.mjs for the decision logic.
# A maintainer promotes each staged version (2FA); CI cannot publish live.
#
# Authentication uses OIDC trusted publishing (tokenless) with provenance:
# - `id-token: write` lets GitHub mint the OIDC token pnpm exchanges for a
# short-lived npm token and uses to sign the provenance attestation.
# - Configure a "Trusted Publisher" for each package on npmjs.com pointing at
# repo `jaredwray/cacheable` + workflow `release.yml`. Once configured, no
# npm token is needed (pnpm 11 performs the OIDC exchange natively).
# - This workflow is fully tokenless: every package must have a
# trusted publisher configured first (stage-only on npmjs.com). A brand-new
# package's first-ever publish (which OIDC cannot do) needs a one-time
# manual `pnpm publish`.
on:
# Manual runs — supports a dry run that prints the plan and validates
# packaging without publishing anything.
workflow_dispatch:
inputs:
dry-run:
description: "Dry run (compute the plan + validate packaging, publish nothing)"
type: boolean
default: false
# Publishing a (non-pre) GitHub release publishes the bumped packages to npm,
# in lockstep with the website deploy, which also runs on `released`.
release:
types: [released]
# Never run two releases at once; let an in-flight publish finish rather than
# cancelling it half-way through the package set.
concurrency:
group: release
cancel-in-progress: false
permissions:
contents: read
jobs:
aikido-gate:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Install Socket Firewall
uses: SocketDev/action@ba6de6cc0565af1f42295590380973573297e31f # v1.3.2
with:
mode: firewall-free
firewall-version: "1.15.4"
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
package-manager-cache: false
- name: Install Aikido CI client
# zizmor: ignore[adhoc-packages] pinned Aikido CI client for the release gate
run: sfw npm install --global @aikidosec/ci-api-client@1.0.17
# Fails on new SAST/IaC/secrets findings. The API key comes from Aikido's
# Continuous Integration settings — it grants no publish authority.
- name: Run Aikido release scan
env:
REPO_NAME: ${{ github.event.repository.name }}
AIKIDO_CLIENT_API_KEY: ${{ secrets.AIKIDO_CLIENT_API_KEY }}
run: >
aikido-api-client scan-release
"$REPO_NAME" "$GITHUB_SHA"
--apikey "$AIKIDO_CLIENT_API_KEY"
--fail-on-sast-scan --fail-on-iac-scan --fail-on-secrets-scan
release:
needs: [aikido-gate]
runs-on: ubuntu-latest # provenance/OIDC require a cloud-hosted runner
permissions:
contents: read
id-token: write # required for OIDC trusted publishing + provenance
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# This job only reads the repo (it never pushes), so don't leave the
# GITHUB_TOKEN in .git/config for later steps / actions to read.
persist-credentials: false
- name: Install Socket Firewall
uses: SocketDev/action@ba6de6cc0565af1f42295590380973573297e31f # v1.3.2
with:
mode: firewall-free
firewall-version: "1.15.4"
- name: Install pnpm
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
- name: Use Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .nvmrc
registry-url: https://registry.npmjs.org # writes the .npmrc the registry expects
package-manager-cache: false
- name: Enable Corepack
run: corepack enable
- name: Install dependencies
run: sfw pnpm install --frozen-lockfile
- name: Build
run: pnpm build
- name: Validate build output
run: node scripts/test-build.mjs
- name: Release
# A published release publishes for real. A manual (workflow_dispatch)
# run honors its dry-run input, and is forced to a dry run from any ref
# other than main so branch versions can't be pushed to npm.
run: node scripts/release.mjs ${{ (github.event_name == 'workflow_dispatch' && (inputs.dry-run || github.ref != 'refs/heads/main')) && '--dry-run' || '' }}