1
1
mirror of https://github.com/primer/css.git synced 2024-12-25 15:14:59 +03:00

Adding rc workflow

This commit is contained in:
Jon Rohan 2021-04-04 21:10:34 -07:00
parent 0a45e08868
commit 2fcd314eb6
No known key found for this signature in database
GPG Key ID: B0BBE304A9A0AECB

57
.github/workflows/release_candidate.yml vendored Normal file
View File

@ -0,0 +1,57 @@
name: Release
on:
pull_request:
branches:
- 'changeset-release/main'
jobs:
release-candidate:
if: ${{ github.repository == 'primer/css' }}
name: Candidate
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
- 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 release candidate
run: |
version=$(jq -r .version package.json)
echo "$( jq ".version = \"$(echo $version)-rc.$(git rev-parse --short HEAD)\"" package.json )" > package.json
yarn publish --tag next
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Output candidate 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}/`
})