-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (61 loc) · 2 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
65
66
67
68
69
name: Release new version
on:
workflow_dispatch:
inputs:
version:
type: choice
description: Version
options:
- patch
- minor
- major
- prerelease
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
actions: write
steps:
- name: Checkout
uses: actions/checkout@v4
# Needed to make possible changelog generation only from latest tag
with:
fetch-depth: 0
fetch-tags: true
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 9
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 20
cache: pnpm
- name: Install Dev Dependencies
run: pnpm install -D
- name: Bump package.json version
id: version
run: |
echo "OLD_VERSION=$(pnpm pkg get version | tr -d '"')" >> "$GITHUB_OUTPUT"
pnpm version ${{ github.event.inputs.version }} --preid rc --git-tag-version=false
echo "NEW_VERSION=$(pnpm pkg get version | tr -d '"')" >> "$GITHUB_OUTPUT"
- name: Generate changelog
run: pnpm changelog:generate -t v${{ steps.version.outputs.OLD_VERSION }} || pnpm changelog:generate
- name: Create github release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.email [email protected]
git config --global user.name "CI/CD Bot"
git add package.json
git commit -m "version v${{ steps.version.outputs.NEW_VERSION }}"
git tag v${{ steps.version.outputs.NEW_VERSION }}
git push
git push --tags
gh release create v${{ steps.version.outputs.NEW_VERSION }} --notes-file CHANGELOG.md
- name: Trigger publish
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh workflow run publish.yml -r v${{ steps.version.outputs.NEW_VERSION }}