Skip to content

Build release

Build release #6

Workflow file for this run

name: Build release
on:
push:
tags:
- '*'
release:
types: [ published ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v5
- name: Setup up JDK 21
uses: actions/setup-java@v5
with:
java-version: '21'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5
with:
cache-read-only: ${{ github.ref != 'refs/heads/main' }}
- name: Read version from gradle.properties
id: gradle_props
run: |
VERSION=$(grep "^version" gradle.properties | cut -d'=' -f2 | tr -d '[:space:]')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
- name: Build with Gradle
run: ./gradlew build
- name: Upload JAR as artifact
uses: actions/upload-artifact@v4
with:
name: SAPI-${{ steps.gradle_props.outputs.version }}
path: build/libs/SAPI*.jar
- name: Create or Update Release
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'release'
uses: softprops/action-gh-release@v2
with:
name: Release ${{ steps.gradle_props.outputs.version }}
tag_name: ${{ github.ref_name }}
files: build/libs/*.jar
generate_release_notes: true
fail_on_unmatched_files: false
draft: false
prerelease: ${{ contains(github.ref_name, 'beta') || contains(github.ref_name, 'alpha') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}