Skip to content

Commit 14ecc6b

Browse files
committed
ci(release): Added release workflow
1 parent 2aace6f commit 14ecc6b

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

.github/workflows/release.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
paths:
9+
- './gradle.properties'
10+
11+
# workflow_dispatch:
12+
# inputs:
13+
# version:
14+
# description: 'Version Type'
15+
# required: true
16+
# type: choice
17+
# options:
18+
# - 'Major'
19+
# - 'Minor'
20+
# - 'Patch'
21+
22+
permissions:
23+
contents: write
24+
25+
jobs:
26+
check-release:
27+
runs-on: ubuntu-latest
28+
name: Check Release
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
- name: 'Get Version'
33+
id: get-version
34+
run: |-
35+
echo "VERSION=$(cat gradle.properties | grep mod_version | cut -d'=' -f2)" >> $GITHUB_OUTPUT
36+
37+
38+
- name: 'Check for existing release'
39+
id: 'check-for-existing-tag'
40+
env:
41+
VERSION: ${{ steps.get-version.outputs.VERSION }}
42+
43+
run: |
44+
if [ $(git tag -l "$VERSION")]; then
45+
echo "Tag \"$VERSION\" already exists. Skipping next jobs."
46+
echo "TAG_EXISTS=TRUE" >> "$GITHUB_OUTPUT"
47+
else
48+
echo "Tag \"$VERSION\" does not exist. Running next jobs."
49+
echo "TAG_EXISTS=FALSE" >> "$GITHUB_OUTPUT"
50+
fi
51+
52+
outputs:
53+
TAG_EXISTS: ${{ steps.check-for-existing-tag.outputs.TAG_EXISTS }}
54+
VERSION: ${{ steps.get-version.outputs.VERSION }}
55+
56+
release:
57+
needs: check-release
58+
if: ${{ needs.check-release.outputs.TAG_EXISTS == 'FALSE' }}
59+
runs-on: ubuntu-latest
60+
name: Release
61+
env:
62+
VERSION: ${{ needs.check-release.outputs.VERSION }}
63+
64+
steps:
65+
- uses: actions/checkout@v4
66+
67+
- name: 'Draft Release'
68+
id: draft-release
69+
uses: mathieudutour/[email protected]
70+
with:
71+
github_token: ${{ secrets.GITHUB_TOKEN }}
72+
custom_tag: ${{ env.VERSION }}
73+
74+
75+
76+
77+

0 commit comments

Comments
 (0)