-
Notifications
You must be signed in to change notification settings - Fork 31
57 lines (44 loc) · 1.52 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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 }}