-
Notifications
You must be signed in to change notification settings - Fork 4
68 lines (57 loc) · 1.88 KB
/
Copy pathrelease.yaml
File metadata and controls
68 lines (57 loc) · 1.88 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
68
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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
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 pnpm
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
- name: Setup NodeJS
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: package.json
registry-url: "https://registry.npmjs.org"
package-manager-cache: false
- name: Install dependencies
run: pnpm install
- 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'
pnpm version ${{ github.event.inputs.release-type }} --message "chore: v%s"
- name: Build project
run: |
pnpm run build
- name: Publish new version
run: |
git push --follow-tags
pnpm stage publish