-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (41 loc) · 1.44 KB
/
build-and-publish-npm-package.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
name: Build Design System package
on:
push:
branches:
- main
pull_request:
release:
types: [created]
jobs:
build:
runs-on: [ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://npm.pkg.github.com'
scope: '@ZeroGachis'
# Skip post-install scripts here, as a malicious
# script could steal GITHUB_TOKEN.
- name: Install dependencies
run: npm ci --ignore-scripts
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# `npm rebuild` will run all those post-install scripts for us.
- name: Rebuild & Prepare dependencies
run: npm rebuild && npm run prepare --if-present
- name: Update package version
uses: mingjun97/file-regex-replace@v1
with:
regex: '"version": "([0-9.]*)"'
replacement: '"version": "${{ github.ref_name }}"'
include: 'package.json'
- name: Compile
run: npm run tsc
- name: Publish
if: startsWith(github.ref, 'refs/tags/')
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}