-
Notifications
You must be signed in to change notification settings - Fork 29
117 lines (111 loc) · 3.38 KB
/
beta-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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: Release Beta Version
on:
workflow_dispatch:
schedule:
- cron: '7 6 * * *'
jobs:
get-commit:
name: Get commit message
runs-on: ubuntu-latest
outputs:
msg: ${{ steps.set-msg.outputs.msg }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- id: set-msg
name: Set commit message variable
run: |
commitMessages=$(git log $(git describe --tags --abbrev=0)..@ --pretty=format:"%s" --no-merges | sed '/chore/d' | sed '/docs/d' | sed '/style/d' | sed '/test/d' | sed '/ci/d' | sed '/build/d' | sed '/refactor/d' | sed '2,$d')
echo "msg=${commitMessages}"
echo "msg=${commitMessages}" >> $GITHUB_OUTPUT
bump-version:
name: Bump version
needs: get-commit
if: ${{ needs.get-commit.outputs.msg != '' && needs.get-commit.outputs.msg != null }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Automated Version Bump
id: version-bump
uses: phips28/[email protected]
with:
version-type: prerelease
preid: 'beta'
tag-prefix: 'v'
skip-tag: 'true'
bump-policy: 'last-commit'
commit-message: 'chore: bump version to {{version}} [skip ci]'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Output new version
env:
NEW_VERSION: ${{ steps.version-bump.outputs.newTag }}
run: echo "new version $NEW_VERSION"
outputs:
newTag: ${{ steps.version-bump.outputs.newTag }}
draft-release:
name: Draft release
runs-on: ubuntu-latest
needs: bump-version
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Create draft release
id: create_release
uses: ncipollo/release-action@v1
with:
name: ${{ needs.bump-version.outputs.newTag }}
tag: ${{ needs.bump-version.outputs.newTag }}
commit: 'master'
draft: true
prerelease: true
generateReleaseNotes: true
outputs:
id: ${{ steps.create_release.outputs.id }}
build:
needs: draft-release
uses: ./.github/workflows/build.yml
with:
checkout-latest: true
secrets:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
publish-release:
name: 'Publish release'
runs-on: ubuntu-latest
needs: [bump-version, build]
permissions:
contents: write
steps:
- uses: ncipollo/release-action@v1
with:
name: ${{ needs.bump-version.outputs.newTag }}
tag: ${{ needs.bump-version.outputs.newTag }}
draft: false
prerelease: true
allowUpdates: true
omitBodyDuringUpdate: true
updateOnlyUnreleased: true
token: ${{ secrets.GITHUB_TOKEN }}
cleanup:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Delete older beta releases
uses: wow-actions/delete-stale-releases@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
keep_latest_count: '2'
keep_latest_days: '2'
include: '*beta*'
include_draft: 'false'
dry-run: 'true'