-
Notifications
You must be signed in to change notification settings - Fork 5
67 lines (56 loc) · 1.78 KB
/
Copy pathrelease.yaml
File metadata and controls
67 lines (56 loc) · 1.78 KB
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
name: Release new version
on:
workflow_dispatch:
inputs:
release-type:
type: choice
description: Select the release type
required: true
options:
- major
- patch
- minor
permissions:
id-token: write
contents: write
jobs:
release:
runs-on: ubuntu-latest
name: Release new version
steps:
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0 # Required to get all existing tags
fetch-tags: true
- name: Stop if there are no new changes
run: |
LATEST_TAG=$(git describe --tags --abbrev=0 --always)
LAST_COMMIT=$(git rev-parse HEAD)
LASTEST_TAG_COMMIT=$(git rev-list -n 1 $LATEST_TAG)
if [ "$LASTEST_TAG_COMMIT" == "$LAST_COMMIT" ]; then
echo "No new changes since the last tag. Stopping the workflow."
exit 1
fi
exit 0
- name: Setup NodeJS
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
registry-url: 'https://registry.npmjs.org'
package-manager-cache: false
- name: Upgrade npm
run: npm install -g npm@11.17.0
- name: Install dependencies
run: npm ci
- name: Create new version
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
npm version ${{ github.event.inputs.release-type }} -m "chore: v%s"
- name: Build project
run: |
npm run build
- name: Publish new version
run: |
git push --follow-tags
npm stage publish