Skip to content

Automated Version Increment #12

Automated Version Increment

Automated Version Increment #12

Workflow file for this run

# This should create an installation zip for Windows, MacOS, and Linux,
# then attach them to a draft release.
name: Release Installer
on:
pull_request:
types: [closed]
branches: [master]
workflow_dispatch:
permissions:
contents: write
jobs:
# JOB 1: Build the installers on 3 different OSs
build:
if: |
github.event.pull_request.merged == true &&
startsWith(github.event.pull_request.head.ref, 'increment-version-number-')
name: Build on ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y binutils fakeroot
- name: Build Installer
run: ./gradlew build jpackage
- name: Get Version
id: get_version
shell: bash
run: echo "VERSION=$(cat legup-update/src/main/resources/edu.rpi.legupupdate/VERSION | xargs)" >> $GITHUB_OUTPUT
- name: Zip Installer (Windows)
if: runner.os == 'Windows'
run: Compress-Archive -Path build/installer/* -DestinationPath Legup-Windows-${{ steps.get_version.outputs.VERSION }}.zip
- name: Zip Installer (Mac/Linux)
if: runner.os != 'Windows'
run: |
cd build/installer
zip -r ../../Legup-${{ matrix.os }}-${{ steps.get_version.outputs.VERSION }}.zip .
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: installer-${{ matrix.os }}
path: ./*.zip
# JOB 2: Collect all zips and create the Release
create_release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get Version
id: get_version
shell: bash
run: echo "VERSION=$(cat legup-update/src/main/resources/edu.rpi.legupupdate/VERSION | xargs)" >> $GITHUB_OUTPUT
- name: Download All Artifacts
uses: actions/download-artifact@v4
with:
pattern: installer-*
merge-multiple: true
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.get_version.outputs.VERSION }}
name: Release v${{ steps.get_version.outputs.VERSION }}
draft: true
prerelease: false
files: |
*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}