p-graph/.github/workflows/release.yml

60 строки
1.9 KiB
YAML

name: Release
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# NOTE: Because this package is inactive, the npm and github token secrets have been removed.
# Before running this workflow, you must generate a new granular npm token and github token,
# go to Settings => Environments => release, and add the secrets REPO_PAT and NPM_AUTHTOKEN.
# You'll also need to update the ruleset for main to allow a bypass.
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
on:
workflow_dispatch:
# push:
# branches: [main]
jobs:
build:
runs-on: ubuntu-latest
# This environment contains secrets needed for publishing
environment: release
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
# Don't save creds in the git config (so it's easier to override later)
persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: yarn
- run: yarn build
- run: yarn test
- name: Publish package
run: |
git config user.email "kchau@microsoft.com"
git config user.name "Ken Chau"
# Get the existing remote URL without creds, and use a trap (like try/finally)
# to restore it after this step finishes
trap "git remote set-url origin '$(git remote get-url origin)'" EXIT
# Add a token to the remote URL for auth during release
git remote set-url origin "https://$REPO_PAT@github.com/$GITHUB_REPOSITORY"
yarn release -y -n "$NPM_AUTHTOKEN"
env:
NPM_AUTHTOKEN: ${{ secrets.NPM_AUTHTOKEN }}
REPO_PAT: ${{ secrets.REPO_PAT }}