Release #509
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
# release daily at 8am UTC (midnight or 1am pacific) | |
# https://crontab-generator.org/ | |
schedule: | |
- cron: "0 8 * * *" | |
# or manual trigger | |
workflow_dispatch: | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
# This environment contains secrets needed for publishing | |
environment: release | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
# Fetch all history (required for publishing which looks at history) | |
fetch-depth: 0 | |
# Don't save creds in the git config (so it's easier to override later) | |
persist-credentials: false | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: .nvmrc | |
- run: yarn | |
- run: yarn build | |
- run: yarn lint | |
- run: yarn test | |
- name: Update git config | |
run: | | |
git config user.email "kchau@microsoft.com" | |
git config user.name "Ken Chau" | |
- name: Publish | |
run: | | |
# 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.git" | |
yarn release -y -n $NPM_AUTHTOKEN | |
env: | |
NPM_AUTHTOKEN: ${{ secrets.NPM_AUTHTOKEN }} | |
REPO_PAT: ${{ secrets.REPO_PAT }} |