Skip to content

Commit d262317

Browse files
authored
Combine release workflows (#2931)
* Combine release workflows * Update version
1 parent eca9add commit d262317

File tree

4 files changed

+73
-107
lines changed

4 files changed

+73
-107
lines changed

.github/workflows/next_major.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 73 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
name: Release
22
on:
33
push:
4-
branches:
5-
- 'main'
6-
- 'next_major'
4+
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.ref }}
7+
cancel-in-progress: true
8+
9+
permissions:
10+
id-token: write # Required for OIDC
11+
contents: read
12+
checks: write
13+
statuses: write
14+
715
jobs:
8-
release:
9-
name: Final
10-
if: ${{ github.repository == 'primer/css' }}
16+
release-main:
17+
name: Main
18+
if: ${{ github.repository == 'primer/css' && github.ref_name == 'main' }}
1119

1220
runs-on: ubuntu-latest
1321
steps:
@@ -19,9 +27,9 @@ jobs:
1927
persist-credentials: false
2028

2129
- name: Set up Node.js
22-
uses: actions/setup-node@v5
30+
uses: actions/setup-node@v6
2331
with:
24-
node-version: 18.x
32+
node-version: 24
2533
cache: 'npm'
2634

2735
- name: Install dependencies
@@ -45,4 +53,60 @@ jobs:
4553
publish: npm run release
4654
env:
4755
GITHUB_TOKEN: ${{ steps.get-access-token.outputs.access-token }}
48-
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN_SHARED }}
56+
57+
release-candidate:
58+
name: Candidate
59+
if: ${{ github.repository == 'primer/css' && github.ref_name == 'changeset-release/main' }}
60+
61+
runs-on: ubuntu-latest
62+
steps:
63+
- name: Checkout repository
64+
uses: actions/checkout@v5
65+
with:
66+
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
67+
fetch-depth: 0
68+
69+
- name: Set up Node.js
70+
uses: actions/setup-node@v6
71+
with:
72+
node-version: 24
73+
cache: 'npm'
74+
75+
- name: Install dependencies
76+
run: npm ci
77+
78+
- name: Publish release candidate
79+
run: |
80+
version=$(jq -r .version package.json)
81+
echo "$( jq ".version = \"$(echo $version)-rc.$(git rev-parse --short HEAD)\"" package.json )" > package.json
82+
npm publish --tag next
83+
env:
84+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85+
86+
- name: Output candidate version number
87+
uses: actions/github-script@v8
88+
with:
89+
script: |
90+
const package = require(`${process.env.GITHUB_WORKSPACE}/package.json`)
91+
github.rest.repos.createCommitStatus({
92+
owner: context.repo.owner,
93+
repo: context.repo.repo,
94+
sha: context.sha,
95+
state: 'success',
96+
context: `Published ${package.name}`,
97+
description: package.version,
98+
target_url: `https://unpkg.com/${package.name}@${package.version}/`
99+
})
100+
101+
- name: Upload versions json file
102+
uses: primer/.github/.github/actions/upload-versions@main
103+
104+
release-canary:
105+
name: Canary
106+
if: ${{ github.repository == 'primer/css' && github.ref_name != 'main' && github.ref_name != 'changeset-release/main' }}
107+
uses: primer/.github/.github/workflows/release_canary.yml@v2.2.1
108+
with:
109+
install: npm ci
110+
secrets:
111+
gh_token: ${{ secrets.GITHUB_TOKEN }}
112+
npm_token: ${{ secrets.NPM_AUTH_TOKEN_SHARED }}

.github/workflows/release_canary.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

.github/workflows/release_candidate.yml

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)