1
1
mirror of https://github.com/primer/css.git synced 2024-10-04 04:17:21 +03:00
css/.github/workflows/release_canary.yml

71 lines
2.1 KiB
YAML
Raw Normal View History

2021-04-05 07:19:30 +03:00
name: Release Canary
2021-03-26 23:26:40 +03:00
on:
2021-03-26 23:29:47 +03:00
push:
2021-03-26 23:26:40 +03:00
branches-ignore:
- 'main'
- 'changeset-release/main'
2021-03-29 18:49:42 +03:00
- 'dependabot/**'
2021-03-27 02:05:04 +03:00
# Don't release canary when these paths change
# It's not necessary because we don't ship them and it creates noise
2021-03-27 01:59:23 +03:00
paths-ignore:
2021-03-27 02:01:29 +03:00
- '.changeset/**'
- '.github/**'
2021-03-27 02:05:04 +03:00
- 'docs/**'
- 'lib/**'
2021-03-30 08:10:17 +03:00
- '__tests__/**'
2021-03-27 02:05:04 +03:00
- 'script/**'
2021-03-29 22:07:44 +03:00
- 'next.config.js'
- 'now.json'
2021-03-26 23:26:40 +03:00
jobs:
release-canary:
if: ${{ github.repository == 'primer/css' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@master
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@master
with:
node-version: 12.x
2021-03-27 01:38:14 +03:00
- 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
2021-03-27 00:03:36 +03:00
with:
script: |
2021-03-27 01:42:22 +03:00
const package = require(`${process.env.GITHUB_WORKSPACE}/package.json`)
2021-03-27 01:32:58 +03:00
github.repos.createCommitStatus({
2021-03-27 01:32:07 +03:00
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.sha,
state: 'success',
2021-03-27 01:38:14 +03:00
context: `Published ${package.name}`,
description: package.version,
target_url: `https://unpkg.com/${package.name}@${package.version}/`
2021-03-27 01:32:07 +03:00
})