-
Notifications
You must be signed in to change notification settings - Fork 525
64 lines (61 loc) · 1.95 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
58
59
60
61
62
63
64
name: Release
permissions:
contents: write
on:
workflow_dispatch:
inputs:
releaseVersion:
type: string
required: true
description: The version of this release. Must be a semantic version of the form X.Y.Z.
dry_run:
type: boolean
required: true
default: false
description: Dry run, will not push branches or upload the artifacts.
pre_release:
type: boolean
required: true
default: false
description: If true, push pre-release tag.
skip_tag:
type: boolean
required: true
default: false
description: If true, don't tag this release, just push it.
jobs:
release:
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout Javascript
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm install
- name: Package
run: ./build-package.sh
- name: Upload
if: ${{ github.event.inputs.dry_run != 'true' && github.event.inputs.pre_release != 'true' }}
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- name: Upload pre-release
if: ${{ github.event.inputs.dry_run != 'true' && github.event.inputs.pre_release == 'true' }}
run: npm publish --tag next
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- name: Tag release
if: ${{ github.event.inputs.skip_tag != 'true' }}
run: |
git config --global user.name 'Github Bot'
git config --global user.email '<>'
git tag ${{ github.events.inputs.releaseVersion }}
- name: Push tag
if: ${{ github.event.inputs.dry_run != 'true' }}
run: |
git push ${{ github.events.inputs.releaseVersion }}