Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
94ff58e1aThis file is pinned to the selected release. Download the original to open it in your design tool.
name: Java CI with Maven
env:
# find out this value by opening `https://api.github.com/repos/<owner>/<repo>/releases`. then find the correct release.
# in your browser and copy the full "upload_url" value including the {?name,label} part.
UPLOAD_URL: https://uploads.github.com/repos/MarginallyClever/Makelangelo-software/releases/54908875/assets{?name,label}
RELEASE_ID: 54908875 # same as above (id can just be taken out the upload_url, it's used to find old releases)
JAVA_VERSION: '22' # add once here
on:
push:
branches: [master, main, dev]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6.0.2
- uses: actions/setup-java@v5.2.0
with:
distribution: 'temurin'
java-version: ${{ env.JAVA_VERSION }}
cache: 'maven'
- name: Build and Test with Maven
run: ./mvnw -B test -Djava.awt.headless=true
- name: Package with Maven
run: ./mvnw -B clean package -DskipTests
- name: Prepare target/package for upload
shell: bash
run: |
mkdir -p target/package &&
cp src/main/package/*.bat target/package/ &&
cp src/main/package/start* target/package/ &&
cp src/main/package/thankyou.* target/package/ &&
cp CONTRIBUTING.md target/package/ &&
cp LICENSE target/package/ &&
cp README.md target/package/
- name: Upload common files
uses: actions/upload-artifact@v7.0.1
with:
name: shared
path: |
src/main/package/jpackage*
src/main/package/logo*
LICENSE
README
target/package/*
delete-nightly-assets:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'
steps:
- name: Delete all assets from Nightly Builds release
uses: actions/github-script@v9
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { owner, repo } = context.repo;
const release_id = 54908875; // Nightly Builds release
const assets = await github.rest.repos.listReleaseAssets({ owner, repo, release_id });
if (assets.data.length === 0) {
console.log("No assets to delete.");
}
for (const asset of assets.data) {
console.log(`Deleting asset: ${asset.name}`);
await github.rest.repos.deleteReleaseAsset({
owner,
repo,
asset_id: asset.id,
});
}
package:
needs: delete-nightly-assets
strategy:
matrix:
include:
- runs_on: macos-15-intel
arch: x64
java_arch: x64
os_label: mac-intel
- runs_on: macos-latest
arch: arm64
java_arch: aarch64
os_label: mac-arm64
- runs_on: ubuntu-latest
arch: x64
java_arch: x64
os_label: ubuntu
- runs_on: windows-latest
arch: x64
java_arch: x64
os_label: windows
runs-on: ${{ matrix.runs_on }}
steps:
- uses: actions/checkout@v6.0.2
- uses: actions/setup-java@v5.2.0
with:
distribution: 'temurin'
cache: 'maven'
java-version: ${{ env.JAVA_VERSION }}
architecture: ${{ matrix.java_arch }}
- uses: actions/download-artifact@v8.0.1
with:
name: shared
- name: Build installer and rename
shell: bash
run: |
set -euo pipefail
APP_VERSION=$(ls -1 target/package/Makelangelo-*-with-dependencies.jar | sed "s/.*Makelangelo-\([^-]*\)-with-dependencies.jar/\1/")
sed -i.bak "s/\(--app-version\).*/\1 $APP_VERSION/" src/main/package/jpackage.cfg
APP_NAME="Makelangelo-${{ matrix.os_label }}"
jpackage "@src/main/package/jpackage.cfg" "@src/main/package/jpackage-${{ matrix.runs_on }}.cfg" \
--main-jar "Makelangelo-$APP_VERSION-with-dependencies.jar" \
--name "$APP_NAME"
BINARY=$(find . -maxdepth 1 -iname 'makelangelo*' | grep -E '\.msi$|\.deb$|\.dmg$')
EXT="${BINARY##*.}"
DATE=$(date +%Y%m%d)
BINARY_NIGHTLY="$APP_NAME-$DATE.$EXT"
mv "$BINARY" "$BINARY_NIGHTLY"
echo "BINARY_NIGHTLY=$BINARY_NIGHTLY" >> $GITHUB_ENV
- name: Upload to Nightly Builds
uses: WebFreak001/deploy-nightly@v3.2.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
upload_url: ${{ env.UPLOAD_URL }}
release_id: ${{ env.RELEASE_ID }}
asset_path: ${{ env.BINARY_NIGHTLY }}
asset_name: ${{ env.BINARY_NIGHTLY }}
asset_content_type: application/octet-stream