Skip to content

Commit

Permalink
Fix release canary
Browse files Browse the repository at this point in the history
  • Loading branch information
jonrohan committed Oct 12, 2023
1 parent 5f3ebd3 commit 378a08a
Showing 1 changed file with 9 additions and 62 deletions.
71 changes: 9 additions & 62 deletions .github/workflows/release_canary.yml
Original file line number Diff line number Diff line change
@@ -1,71 +1,18 @@
name: Release Canary
name: Release
on:
push:
branches-ignore:
- 'main'
- 'changeset-release/main'
- 'dependabot/**'
# To avoid unnecessary noise, we don't create canary releases when these paths change:
paths-ignore:
- '.changeset/**'
- '.devcontainer/**'
- '.github/**'
- '.storybook/**'
- '.vscode/**'
- 'docs/**'
- 'changeset-release/**'

jobs:
release-canary:
name: Canary
name: npm
if: ${{ github.repository == 'primer/behaviors' }}

runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Create .npmrc
run: |
cat << EOF > "$HOME/.npmrc"
//registry.npmjs.org/:_authToken=$NPM_TOKEN
EOF
env:
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN_SHARED }}

- name: Publish canary version
run: |
echo "$( jq '.version = "0.0.0"' package.json )" > package.json
echo -e "---\n'@primer/behaviors': patch\n---\n\nFake entry to force publishing" > .changeset/force-snapshot-release.md
yarn changeset version --snapshot
yarn changeset publish --tag canary
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Output canary version number
uses: actions/github-script@v6.4.1
with:
script: |
const package = require(`${process.env.GITHUB_WORKSPACE}/package.json`)
github.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.sha,
state: 'success',
context: `Published ${package.name}`,
description: package.version,
target_url: `https://unpkg.com/${package.name}@${package.version}/`
})
uses: primer/.github/.github/workflows/release_canary.yml@main
with:
install: npm i
secrets:
gh_token: ${{ secrets.GITHUB_TOKEN }}
npm_token: ${{ secrets.NPM_AUTH_TOKEN_SHARED }}

0 comments on commit 378a08a

Please sign in to comment.