name: Build release packages
on:
push:
tags: ['v*.*.*']
permissions:
contents: read
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
package:
name: Package ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
include:
- platform: macos
runner: macos-15
- platform: windows
runner: ubuntu-24.04
- platform: linux
runner: ubuntu-24.04
runs-on: ${{ matrix.runner }}
env:
FMM_LOCAL_BUILD: '1'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- uses: oven-sh/setup-bun@v2
with:
bun-version: '1.4.0'
- name: Verify tag and release notes
run: |
version=$(bun -e 'import { workspaceVersion } from "./tools/package.ts"; console.log(workspaceVersion(await Bun.file("Cargo.toml").text()))')
test "$GITHUB_REF_NAME" = "v$version"
test -s RELEASE_NOTES.md
- name: Install Darwin targets
if: matrix.platform == 'macos'
run: |
rustup toolchain install 1.99.1 --profile minimal --target x86_64-apple-darwin,aarch64-apple-darwin
rustup default 1.99.1
- name: Install Podman
if: matrix.runner == 'ubuntu-24.04'
run: |
if ! command -v podman >/dev/null; then
sudo apt-get update
sudo apt-get install -y podman
fi
- run: bun tools/package.ts ${{ matrix.platform }} --headless
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform }}
path: out/release/*/FactorioModManager-*
if-no-files-found: error
draft:
needs: package
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/download-artifact@v4
with:
path: packages
merge-multiple: true
- name: Create draft release
env:
GH_TOKEN: ${{ github.token }}
run: |
if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then
echo "Release already exists. The packages are available as workflow artifacts."
exit 0
fi
gh release create "$GITHUB_REF_NAME" packages/FactorioModManager-* \
--verify-tag --draft --title "Factorio Mod Manager ${GITHUB_REF_NAME#v}" \
--notes-file RELEASE_NOTES.md