forked from ho-dev/HattrickOrganizer
-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (98 loc) · 3.86 KB
/
release-dev.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
name: Automated DEV Release
on:
push:
branches:
- "master"
- "release/**"
jobs:
release-dev:
runs-on: ubuntu-latest
permissions:
contents: write
discussions: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v2
- name: Download and install install4j
run: wget https://download-gcdn.ej-technologies.com/install4j/install4j_linux-x64_10_0_6.deb && sudo dpkg -i install4j_linux-x64_10_0_6.deb
- name: Build with Gradle
run: ./gradlew release
env:
INSTALL4J_HOME: /opt/install4j10
INSTALL4J_LICENSE: ${{ secrets.INSTALL4J_LICENSE }}
POEDITOR_APIKEY: ${{ secrets.POEDITOR_APIKEY }}
RUN_NUMBER: ${{ github.run_number }}
RELEASE_ARTEFACTS: true
- name: Read version properties
id: read_version_properties
uses: christian-draeger/[email protected]
with:
path: 'version.properties'
properties: 'version shortVersion tag branch'
- name: Show version
id: show_version
run: cat version.properties
- name: Delete previous tag and release
uses: ClementTsang/[email protected]
with:
delete_release: true
tag_name: ${{ steps.read_version_properties.outputs.tag }}
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
- name: Create a Release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
files: |
build/artefacts/**
name: ${{ steps.read_version_properties.outputs.version }}
tag_name: ${{ steps.read_version_properties.outputs.tag }}
body_path: docs/md/release_notes.md
target_commitish: ${{ steps.read_version_properties.outputs.branch }}
prerelease: true
# Well, yuck... but hopefully this does the trick:
- name: Publish Release
run: |
curl --request PATCH \
--header 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'Content-type: application/json' \
--header 'User-Agent: Github-Action' \
--url https://api.github.com/repos/ho-dev/HattrickOrganizer/releases/${{ steps.create_release.outputs.id }} \
--data '{ "draft": false }'
- name: If not dev-release delete previous short version tag
if: ${{ steps.read_version_properties.outputs.tag != 'dev' }}
uses: ClementTsang/[email protected]
with:
delete_release: true
tag_name: ${{ steps.read_version_properties.outputs.shortVersion }}
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
- name: If not dev-release create a Release with short version tag
if: ${{ steps.read_version_properties.outputs.tag != 'dev' }}
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
files: |
build/artefacts/**
name: ${{ steps.read_version_properties.outputs.version }}
tag_name: ${{ steps.read_version_properties.outputs.shortVersion }}
body_path: docs/md/release_notes.md
target_commitish: ${{ steps.read_version_properties.outputs.branch }}
prerelease: ${{ steps.read_version_properties.outputs.tag != 'tag_stable' }}
- name: If 'tag_stable' release, also create 'stable' tag
if: ${{ steps.read_version_properties.outputs.tag == 'tag_stable' }}
uses: rickstaa/[email protected]
with:
tag: stable
tag_exists_error: false