-
Notifications
You must be signed in to change notification settings - Fork 3
68 lines (65 loc) · 2.26 KB
/
release-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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Publish
on:
pull_request:
types:
- closed
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 20
- run: npm ci
publish-gpr:
if: github.event_name == 'workflow_dispatch' || (github.event.pull_request.merged == true && github.event.pull_request.head.label == 'video-db:release')
needs: build
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@main
- name: Check Version for Tag
id: npm-tag
run: |
VERSION=${{ steps.package-version.outputs.current-version }}
if [[ $VERSION == *beta* || $VERSION == *alpha* || $VERSION == *rc* ]]; then
echo "tag=next" >> $GITHUB_OUTPUT
else
echo "tag=latest" >> $GITHUB_OUTPUT
fi
############# TAG RELEASE ##############
- name: 'Push tag v${{ steps.package-version.outputs.current-version }}'
if: steps.npm-tag.outputs.tag == 'latest'
uses: rickstaa/action-create-tag@v1
id: tag_version
with:
tag: 'v${{ steps.package-version.outputs.current-version }}'
# ############# GITHUB RELEASE ##############
- name: Extract release notes
id: extract-release-notes
uses: ffurrer2/extract-release-notes@v1
- name: 'Create a GitHub release v${{ steps.package-version.outputs.current-version }}'
if: steps.npm-tag.outputs.tag == 'latest'
uses: ncipollo/release-action@v1
with:
tag: 'v${{ steps.package-version.outputs.current-version }}'
name: 'Release v${{ steps.package-version.outputs.current-version }}'
body: |
${{ steps.extract-release-notes.outputs.release_notes }}
- run: npm ci
- run: npm publish --access public --tag ${{ steps.npm-tag.outputs.tag }}
env:
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}