-
Notifications
You must be signed in to change notification settings - Fork 3
83 lines (70 loc) · 2.21 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Version and Release
on:
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
versioning:
name: Versioning
runs-on: ubuntu-latest
outputs:
hasChangesets: ${{ steps.changesets.outputs.hasChangesets }}
version: ${{ steps.version.outputs.CURRENT_VERSION }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Setup Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Install Dependencies
run: npm ci
- name: Create Release Pull Request
id: changesets
uses: changesets/action@v1
with:
commit: "Version Image"
title: "Version Image"
version: npm run version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get current version
id: version
run: echo "CURRENT_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
release:
name: Release
runs-on: ubuntu-latest
needs: versioning
if: needs.versioning.outputs.hasChangesets == 'false'
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure git
run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
- name: Setup Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Publish tags
id: publish
uses: ./.github/actions/publish
with:
version: ${{ needs.versioning.outputs.version }}
- name: Get release notes
id: notes
if: steps.publish.outputs.published == 'true'
uses: ./.github/actions/get-release-notes
with:
version: ${{ needs.versioning.outputs.version }}
changelog: ./CHANGELOG.md
- name: Create release
if: steps.notes.outputs.release_notes
uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5
with:
body: ${{ steps.notes.outputs.release_notes }}
tag_name: v${{ needs.versioning.outputs.version }}