1
1
mirror of https://github.com/primer/css.git synced 2025-01-07 23:11:42 +03:00

If the release doesn't publish, then publish rc

This commit is contained in:
Jon Rohan 2021-03-29 10:46:16 -07:00
parent d02d19b6de
commit 3993dbcc79
No known key found for this signature in database
GPG Key ID: B0BBE304A9A0AECB

View File

@ -35,3 +35,36 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN_SHARED }}
- name: Create .npmrc
if: steps.changesets.outputs.published != 'true'
run: |
cat << EOF > "$HOME/.npmrc"
//registry.npmjs.org/:_authToken=$NPM_TOKEN
EOF
env:
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN_SHARED }}
- name: Publish release candidate
if: steps.changesets.outputs.published != 'true'
run: |
echo "$( jq ".version = \"$(echo $version)-rc.$(echo $GITHUB_SHA)\"" package.json )" > package.json
yarn publish -tag next
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Output canary version number
if: steps.changesets.outputs.published != 'true'
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}/`
})