Skip to content

Commit 0a32098

Browse files
committed
Add canary
1 parent 1b1e38e commit 0a32098

File tree

3 files changed

+64
-28
lines changed

3 files changed

+64
-28
lines changed

.github/workflows/release.yml

Lines changed: 62 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
name: Release
2+
23
on:
34
push:
4-
branches:
5-
- 'main'
5+
workflow_dispatch:
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
permissions:
12+
id-token: write # Required for OIDC
13+
contents: read
14+
checks: write
15+
statuses: write
16+
617
jobs:
7-
release:
8-
name: Final
9-
if: ${{ github.repository == 'primer/stylelint-config' }}
18+
release-main:
19+
name: Main
20+
if: ${{ github.repository == 'primer/stylelint-config' && github.ref_name == 'main' }}
1021

1122
runs-on: ubuntu-latest
1223
steps:
@@ -15,7 +26,6 @@ jobs:
1526
with:
1627
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
1728
fetch-depth: 0
18-
persist-credentials: false
1929

2030
- name: Set up Node.js
2131
uses: actions/setup-node@v5
@@ -30,6 +40,50 @@ jobs:
3040
title: Release Tracking
3141
# This expects you to have a script called release which does a build for your packages and calls changeset publish
3242
publish: npm run release
43+
44+
release-canary:
45+
name: Canary
46+
if: ${{ github.repository == 'primer/stylelint-config' && github.ref_name != 'main' && github.ref_name != 'changeset-release/main' }}
47+
runs-on: ubuntu-latest
48+
steps:
49+
- name: Checkout repository
50+
uses: actions/checkout@v5
51+
with:
52+
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
53+
fetch-depth: 0
54+
55+
- name: Set up Node
56+
uses: actions/setup-node@v6
57+
with:
58+
node_version: 24
59+
60+
- name: Install dependencies
61+
run: npm ci
62+
63+
- name: Build
64+
run: npm run build --if-present
65+
66+
- name: Publish canary release
67+
run: |
68+
echo "$( jq '.version = "0.0.0"' package.json )" > package.json
69+
echo -e "---\n$( jq .name package.json ): patch\n---\n\nFake entry to force publishing" > .changeset/force-snapshot-release.md
70+
npx changeset version --snapshot
71+
npx changeset publish --tag canary
3372
env:
34-
GITHUB_TOKEN: ${{ secrets.GPR_AUTH_TOKEN_SHARED }}
35-
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN_SHARED }}
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
75+
- name: Output canary version
76+
uses: actions/github-script@v8
77+
with:
78+
script: |
79+
const package = require(`${process.env.GITHUB_WORKSPACE}/package.json`)
80+
github.rest.repos.createCommitStatus({
81+
owner: context.repo.owner,
82+
repo: context.repo.repo,
83+
sha: context.sha,
84+
state: 'success',
85+
context: `Published ${package.name}`,
86+
description: package.version,
87+
target_url: `https://unpkg.com/${package.name}@${package.version}/`
88+
})
89+
- uses: primer/.github/.github/actions/upload-versions@main

.github/workflows/release_canary.yml

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

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)