Skip to content

Use a single workflow with a reusable maven build action #16

Use a single workflow with a reusable maven build action

Use a single workflow with a reusable maven build action #16

Workflow file for this run

on:
push:
branches: [ "*" ]
tags: [ "*" ]
paths-ignore: [ "README.md" ]
workflow_dispatch: { }
env:
JAVA_VERSION: "23"
jobs:
set_variables:
name: "Set build variables"
runs-on: "ubuntu-latest"
outputs:
build_image: "${{ steps.build_variables.outputs.build_image }}"
build_version: "${{ steps.build_variables.outputs.build_version }}"
steps:
- id: "build_variables"
run: |
set -euo pipefail
BUILD_IMAGE="$(echo "ghcr.io/$GITHUB_REPOSITORY" | tr '[:upper:]' '[:lower:]')"
BUILD_VERSION="git-$(date +'%Y%m%d%H%M')-$(echo "$GITHUB_SHA" | head -c 7)"
echo "build_image=$BUILD_IMAGE" | tee -a "$GITHUB_OUTPUT"
echo "build_version=$BUILD_VERSION" | tee -a "$GITHUB_OUTPUT"
build_hotspot:
name: "HotSpot"
runs-on: "ubuntu-latest"
needs: [ "set_variables" ]
container:
image: "ghcr.io/mangadex-pub/jdk-maven:${{ env.JAVA_VERSION }}-corretto"

Check failure on line 32 in .github/workflows/ci.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/ci.yml

Invalid workflow file

The workflow is not valid. .github/workflows/ci.yml (Line: 32, Col: 14): Unrecognized named-value: 'env'. Located at position 1 within expression: env.JAVA_VERSION .github/workflows/ci.yml (Line: 51, Col: 14): Unrecognized named-value: 'env'. Located at position 1 within expression: env.JAVA_VERSION
options: "--user root" # this is sad, but Github CI is (once again) very silly
steps:
- name: "Maven Build (JIT)"
uses: "./.github/actions/maven-build.yml"
with:
BUILD_REVISION: "${{ needs.build_variables.outputs.build_version }}"
MAVEN_JOB_ARGS: "verify package"
- name: "Archive jarfile"
uses: "actions/upload-artifact@v4"
with:
name: "mcw.jar"
path: "target/mcw.jar"
build_graal:
name: "GraalVM"
runs-on: "ubuntu-latest"
needs: [ "set_variables", "build_hotspot" ]
container:
image: "ghcr.io/mangadex-pub/jdk-maven:${{ env.JAVA_VERSION }}-graal"
options: "--user root" # this is sad, but Github CI is (once again) very silly
steps:
- name: "Maven Build (AOT)"
uses: "./.github/actions/maven-build.yml"
with:
BUILD_REVISION: "${{ needs.build_variables.outputs.build_version }}"
MAVEN_JOB_ARGS: "package -Pnative -DskipTests"
- name: "Archive binary"
uses: "actions/upload-artifact@v4"
with:
name: "mcw-${{ runner.os }}-${{ runner.arch }}"
path: "target/mcw"