1
1
mirror of https://github.com/primer/css.git synced 2024-09-20 13:17:29 +03:00
css/.github/workflows/release_canary.yml
2021-04-06 21:53:07 -07:00

72 lines
2.1 KiB
YAML

name: Release
on:
push:
branches-ignore:
- 'main'
- 'changeset-release/main'
- 'dependabot/**'
# Don't release canary when these paths change
# It's not necessary because we don't ship them and it creates noise
paths-ignore:
- '.changeset/**'
- '.github/**'
- 'docs/**'
- 'lib/**'
- '__tests__/**'
- 'script/**'
- 'next.config.js'
- 'now.json'
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: 12.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
yarn changeset version --snapshot
yarn changeset publish --tag canary
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Output canary version number
uses: actions/github-script@v3
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}/`
})