Merge pull request #802 from gurkenlabs/reuse-release-tag #333
Workflow file for this run
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: Release LITIENGINE | |
on: | |
push: | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
workflow_dispatch: | |
inputs: | |
incrementVersion: | |
type: choice | |
description: "increment version?" | |
required: true | |
default: 'none' | |
options: | |
- none | |
- patch | |
- minor | |
- major | |
schedule: | |
# Midnight every day | |
- cron: "0 0 * * *" | |
jobs: | |
release: | |
name: Release build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: read | |
steps: | |
- uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
- name: JDK Setup | |
uses: actions/[email protected] | |
with: | |
distribution: temurin | |
java-version: 21 | |
- name: Gradle Setup | |
uses: gradle/gradle-build-action@v2 | |
- name: Increment version | |
if: inputs.incrementVersion != 'none' && inputs.incrementVersion != '' | |
run: | | |
./gradlew incrementVersion --increment=${{inputs.incrementVersion}} | |
latest_tag=$(git describe --tags --abbrev=0) | |
echo "RELEASE_VERSION=$latest_tag" >> "$GITHUB_ENV" | |
- name: Publish Snapshot | |
if: inputs.incrementVersion == 'none' || inputs.incrementVersion == '' | |
env: | |
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }} | |
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_PASSWORD }} | |
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.PGP_SECRET }} | |
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.PGP_PASSPHRASE }} | |
run: ./gradlew publishToSonatype closeSonatypeStagingRepository | |
- name: Publish Stable | |
if: inputs.incrementVersion != 'none' && inputs.incrementVersion != '' | |
env: | |
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }} | |
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_PASSWORD }} | |
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.PGP_SECRET }} | |
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.PGP_PASSPHRASE }} | |
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository | |
- name: Push tags | |
if: inputs.incrementVersion != 'none' && inputs.incrementVersion != '' | |
env: | |
GRGIT_USER: ${{ secrets.GITHUB_TOKEN }} | |
run: ./gradlew pushTags | |
package: | |
name: Package distribution | |
if: inputs.incrementVersion != 'none' && inputs.incrementVersion != '' | |
needs: release | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, macos-latest, windows-latest ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 21 | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
- name: Package | |
run: ./gradlew jpackage -Prelease=true | |
- name: Upload package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: utiLITI-${{ runner.os }}-$RELEASE_VERSION | |
path: utiliti/build/jpackage | |
# TODO consider uploading the artifacts to itch.io automatically with butler, https://github.com/jdno/setup-butler |