Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
62dbb4043This 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)
on:
push:
branches: [master, main, dev]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-java@v4.7.0
with:
distribution: 'temurin'
java-version: '22'
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@v4.6.2
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@v7.0.1
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:
os: [windows-latest, macos-13, macos-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-java@v4.7.0
with:
distribution: 'temurin'
java-version: '22'
- uses: actions/download-artifact@v4.2.1
with:
name: shared
- name: Build installer and rename
shell: bash
run: |
# Detect current architecture
ARCH=$(uname -m)
case "$ARCH" in
x86_64) ARCH_LABEL="x64" ;;
arm64) ARCH_LABEL="arm64" ;;
*) ARCH_LABEL="$ARCH" ;; # fallback just in case
esac
# Use this to rename the app and output
APP_NAME="Makelangelo-${ARCH_LABEL}"
set -x
set -o 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
jpackage "@src/main/package/jpackage.cfg" "@src/main/package/jpackage-${{ matrix.os }}.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