-
-
Notifications
You must be signed in to change notification settings - Fork 1
57 lines (52 loc) · 1.84 KB
/
release-drafter.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
name: release-drafter
on:
push:
branches:
- 'develop'
pull_request_target:
# Only following types are handled by the action, but one can default to all as well
types: [ opened, reopened, synchronize ]
permissions:
contents: read
jobs:
update-draft-release:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: release-drafter/[email protected]
id: release_drafter
with:
config-name: release-drafter-config.yml
disable-autolabeler: false
commitish: develop
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@v4
- name: Extract version
id: version
run: echo "${{ steps.release_drafter.outputs.resolved_version }}" > VERSION
- name: Calculate code
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
id: code
run: |
IFS='.' read -ra VER <<< "$(cat VERSION)"
MAJOR=$((VER[0] * 1000000000))
MINOR=$((VER[1] * 1000000))
PATCH=$((VER[2] * 1000))
CODE=$((MAJOR + MINOR + PATCH))
echo "version=$(cat VERSION)" > gradle/version.properties
echo "code=$CODE" >> gradle/version.properties
echo "name=v$(cat VERSION)" >> gradle/version.properties
- name: Show version
run: cat gradle/version.properties
- name: Push auto generated version file
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Update version.properties
commit_options: '--no-verify --signoff'
file_pattern: 'gradle/version.properties'
repository: .