-
Notifications
You must be signed in to change notification settings - Fork 6
51 lines (45 loc) · 1.77 KB
/
publish.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
# ---------------------------------------------------------------------------------------------
# Copyright (c) Infiniscene, Inc. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ---------------------------------------------------------------------------------------------
on:
workflow_dispatch:
push:
branches:
- main
name: Tag and release package
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 16
- run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
- run: npm ci
- run: npm run build
- name: Get package version
id: package-version
uses: martinbeentjes/npm-get-version-action@main
- name: Tag commit with release version
id: tag_version
uses: mathieudutour/github-tag-action@v6.0
with:
# Due to a quirk of GitHub actions, we must use an access token of a real user to create
# the tag, since any downstream actions (render deploy) won't trigger if it uses the
# default runner credentials.
github_token: ${{ secrets.SERVICEACCOUNT_GITHUB_TOKEN }}
custom_tag: ${{ steps.package-version.outputs.current-version}}
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
- name: Publish package to NPM
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
access: public