generated from mateusfg7/nextjs-setup
-
Notifications
You must be signed in to change notification settings - Fork 12
97 lines (87 loc) · 2.65 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: 'Release and deploy'
on:
workflow_call:
workflow_dispatch:
jobs:
sync-tag:
name: Sync Tag with Package version
runs-on: ubuntu-22.04
outputs:
isReleaseNew: ${{ steps.bump_tag.outputs.isNew }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: 'main'
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 19.x
- name: Install PNPM
run: npm i -g pnpm
- name: Install Packages
run: pnpm i --dev
- name: Bump Tag
id: bump_tag
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOWS_TOKEN }}
run: |
pnpm bump-tag &&\
echo "isNew=true" >> "$GITHUB_OUTPUT" ||\
echo "isNew=false" >> $GITHUB_OUTPUT
changelog:
name: Changelog
runs-on: ubuntu-latest
needs: sync-tag
if: needs.sync-tag.outputs.isReleaseNew == 'true'
outputs:
changelog: ${{ steps.github_release.outputs.changelog }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: 'main'
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 16.x
- name: Setup git
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Update CHANGELOG.md
run: |
npx conventional-changelog-cli -p conventionalcommits -i CHANGELOG.md -s -r 0 &&\
git add CHANGELOG.md &&\
git commit -m "docs(CHANGELOG): v$(git describe --tags --abbrev=0)" &&\
git push
- name: Build Changelog
id: github_release
run: |
echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$(npx conventional-changelog-cli --preset conventionalcommits -r 2)" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
release:
name: Release
needs: changelog
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: 'main'
- name: Get tag
id: get_tag
run: echo "tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT
- name: Create Release
uses: mikepenz/action-gh-release@v1 #softprops/action-gh-release
with:
body: ${{ needs.changelog.outputs.changelog }}
tag_name: ${{ steps.get_tag.outputs.tag }}
call-sync-dev:
name: Call sync-dev-branch.yml
uses: mateusfg7/mateusf.com/.github/workflows/sync-dev-branch.yml@main
needs: changelog