Skip to content

Commit

Permalink
Use reusable release_canary workflow (#1811)
Browse files Browse the repository at this point in the history
* Use reusable release_canary workflow

* Install with yarn

Co-authored-by: Jon Rohan <yes@jonrohan.codes>
  • Loading branch information
colebemis and jonrohan committed Dec 6, 2021
1 parent 17102e0 commit 4a00387
Showing 1 changed file with 6 additions and 51 deletions.
57 changes: 6 additions & 51 deletions .github/workflows/release_canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:
# It's not necessary because we don't ship them and it creates noise
paths-ignore:
- '.changeset/**'
- '.github/**'
- 'docs/**'
- 'lib/**'
- '__tests__/**'
Expand All @@ -20,53 +19,9 @@ on:
jobs:
release-canary:
name: Canary
if: ${{ github.repository == 'primer/css' }}

runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
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@v2
with:
node-version: 14.x

- name: Install dependencies
run: yarn

- 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/css': patch\n---\n\nFake entry to force publishing" > .changeset/force-snapshot-release.md
rm -f .changeset/pre.json
yarn changeset version --snapshot
yarn changeset publish --tag canary
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Output canary version number
uses: actions/github-script@v5
with:
script: |
const package = require(`${process.env.GITHUB_WORKSPACE}/package.json`)
github.rest.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: yarn
secrets:
github_token: ${{ secrets.GITHUB_TOKEN }}
npm_token: ${{ secrets.NPM_AUTH_TOKEN_SHARED }}

0 comments on commit 4a00387

Please sign in to comment.