Skip to content

chore: add VS Code build tasks #8

chore: add VS Code build tasks

chore: add VS Code build tasks #8

Workflow file for this run

name: Create Release
# TRIGGERS: When this workflow runs
on:
push:
branches:
- main # Run on every push to main branch
- ci/automated-releases
workflow_dispatch: # Allow manual triggering from Actions tab
# PERMISSIONS: What this workflow can do
permissions:
contents: write # Required to create releases and push tags
jobs:
release:
runs-on: windows-latest # Use Windows runner (needed for Windows-specific Maven builds)
steps:
# STEP 1: Get the repository code
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch full history so we can count all commits
# STEP 2: Install Java
- name: Set up JDK 25 with JavaFX
uses: actions/setup-java@v4
with:
distribution: 'zulu' # Use Azul Zulu distribution
java-version: '25' # Java 25
java-package: 'jdk+fx' # Include JavaFX bundle
cache: 'maven' # Cache Maven dependencies for faster builds
# STEP 3: Determine version (either from tag like v0.1.0, or build number like b123)
- name: Determine version
id: version
shell: bash
run: |
TAG=$(git tag --points-at HEAD | grep '^v' | sort -V | tail -n 1 || true)
if [[ -n "$TAG" ]]; then
# Tagged release: extract version from tag (v0.1.0 -> 0.1.0)
VERSION="${TAG}"
IS_TAGGED=true
else
# Build release: use commit count as build number
VERSION="b$(git rev-list --count HEAD)"
IS_TAGGED=false
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "is_tagged=$IS_TAGGED" >> $GITHUB_OUTPUT
echo "Version: $VERSION (tagged: $IS_TAGGED)"
# STEP 4: Build the project with Maven
- name: Build with Maven
run: mvn -B clean package "-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn"
# STEP 5: Prepare artifacts for release
- name: Prepare release artifacts
shell: bash
run: |
VERSION="${{ steps.version.outputs.version }}"
VERSION="${VERSION#v}"
mkdir -p release
# Find Maven-generated zip files
JAR_ZIP=$(find target -name "*-bin-jar.zip")
WIN_ZIP=$(find target -name "*-bin-win-*.zip")
if [[ "${{ steps.version.outputs.is_tagged }}" == "true" ]]; then
# Tagged: use files as-is (assumes pom.xml version matches tag)
cp "$JAR_ZIP" "$WIN_ZIP" release/
else
# Build: rename with build number
PLATFORM=$(basename "$WIN_ZIP" | sed 's/.*-bin-\(.*\)\.zip/\1/')
cp "$JAR_ZIP" "release/xml2table-${VERSION}-bin-jar.zip"
cp "$WIN_ZIP" "release/xml2table-${VERSION}-bin-${PLATFORM}.zip"
fi
ls -lh release/
# STEP 6: Create GitHub release
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
# Tag name: use existing tag (v0.1.0) or created build number tag (b123)
tag_name: ${{ steps.version.outputs.version }}
# Release title
name: ${{ steps.version.outputs.is_tagged == 'true' && format('Release {0}', steps.version.outputs.version) || format('Build {0}', steps.version.outputs.version) }}
# Release description
body: |
${{ steps.version.outputs.is_tagged == 'true' && 'Release' || 'Automated build' }} for version ${{ steps.version.outputs.version }}
**Artifacts:**
- JAR binary with dependencies
- Windows executable with bundled JRE
Commit: ${{ github.sha }}
# Upload all files from release/ directory
files: release/*
# Build releases are marked as pre-release, tagged releases are stable
prerelease: ${{ steps.version.outputs.is_tagged != 'true' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}