-
Notifications
You must be signed in to change notification settings - Fork 4
48 lines (37 loc) · 1.43 KB
/
npm-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
name: Release
# only on manual trigger
on:
workflow_dispatch:
jobs:
build:
runs-on: macos-latest
# You'd need to create this environment and add the secrets NPM_AUTHTOKEN and REPO_PAT
environment: release
steps:
- name: Check out code
uses: actions/checkout@v3
with:
# Don't save creds in the git config (so it's easier to override later)
persist-credentials: false
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "16.x"
- name: Install dependencies
run: cd ux-components && npm install
- name: Build and Test
run: cd ux-components && npm run build
- name: Publish package
run: |
# Git requires these to be set before committing
git config user.email "[email protected]"
git config user.name "kcamas15"
# 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://[email protected]/microsoft/ace-ux-components"
cd ux-components && npm run release -- -y -n $NPM_AUTHTOKEN
env:
NPM_AUTHTOKEN: ${{ secrets.NPM_AUTHTOKEN }}
REPO_PAT: ${{ secrets.REPO_PAT }}