release stable HO8 #45
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |