mirror of
https://github.com/kbenestad/mdcms.git
synced 2026-06-18 15:24:32 +00:00
Adds an ubuntu-24.04-arm matrix entry so each release produces mdcms-linux-arm64 and a matching arm64 .deb alongside the existing amd64 artefacts. Fixes the fpm binary path and .deb artifact name to be matrix-driven so both Linux builds are independent. https://claude.ai/code/session_01LScjwzJJgLKsNrqEPLxJS8
133 lines
3.9 KiB
YAML
133 lines
3.9 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
env:
|
|
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
|
|
|
jobs:
|
|
build:
|
|
name: Build — ${{ matrix.label }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
label: Linux amd64
|
|
binary_name: mdcms
|
|
artifact_name: mdcms-linux-amd64
|
|
make_deb: true
|
|
|
|
- os: macos-latest
|
|
label: macOS arm64
|
|
binary_name: mdcms
|
|
artifact_name: mdcms-macos-arm64
|
|
make_deb: false
|
|
|
|
- os: ubuntu-24.04-arm
|
|
label: Linux arm64
|
|
binary_name: mdcms
|
|
artifact_name: mdcms-linux-arm64
|
|
make_deb: true
|
|
|
|
- os: windows-latest
|
|
label: Windows amd64
|
|
binary_name: mdcms.exe
|
|
artifact_name: mdcms-windows-amd64
|
|
make_deb: false
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
|
|
- name: Install dependencies
|
|
run: pip install pyinstaller click pyyaml certifi
|
|
|
|
- name: Build binary
|
|
run: pyinstaller --onefile --name mdcms mdcms.py
|
|
|
|
- name: Rename binary (non-Windows)
|
|
if: matrix.os != 'windows-latest'
|
|
run: mv dist/mdcms dist/${{ matrix.artifact_name }}
|
|
|
|
- name: Rename binary (Windows)
|
|
if: matrix.os == 'windows-latest'
|
|
run: mv dist/mdcms.exe dist/${{ matrix.artifact_name }}.exe
|
|
|
|
- name: Build .deb (Linux only)
|
|
if: matrix.make_deb
|
|
run: |
|
|
VERSION=${GITHUB_REF_NAME#v}
|
|
sudo gem install fpm --no-document
|
|
fpm \
|
|
-s dir -t deb \
|
|
-n mdcms \
|
|
-v "$VERSION" \
|
|
--description "MD-CMS companion CLI — manage and build MD-CMS sites" \
|
|
--url "https://github.com/kbenestad/mdcms" \
|
|
--maintainer "Kristian Benestad" \
|
|
--license "Apache-2.0" \
|
|
--architecture "${{ matrix.os == 'ubuntu-24.04-arm' && 'arm64' || 'amd64' }}" \
|
|
--category utils \
|
|
dist/${{ matrix.artifact_name }}=/usr/local/bin/mdcms
|
|
|
|
- name: Upload binary artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ matrix.artifact_name }}
|
|
path: |
|
|
dist/${{ matrix.artifact_name }}
|
|
dist/${{ matrix.artifact_name }}.exe
|
|
if-no-files-found: ignore
|
|
|
|
- name: Upload .deb artifact
|
|
if: matrix.make_deb
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: deb-package-${{ matrix.artifact_name }}
|
|
path: "*.deb"
|
|
|
|
release:
|
|
name: Create GitHub Release
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: artifacts
|
|
merge-multiple: false
|
|
|
|
- name: List artifacts
|
|
run: find artifacts -type f
|
|
|
|
- name: Create release
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
PRERELEASE=""
|
|
if [[ "${{ github.ref_name }}" == *"-"* ]]; then
|
|
PRERELEASE="--prerelease"
|
|
fi
|
|
gh release delete "${{ github.ref_name }}" --repo "${{ github.repository }}" --yes 2>/dev/null || true
|
|
gh release create "${{ github.ref_name }}" \
|
|
--repo "${{ github.repository }}" \
|
|
--title "mdcms ${{ github.ref_name }}" \
|
|
--generate-notes \
|
|
$PRERELEASE \
|
|
artifacts/mdcms-linux-amd64/mdcms-linux-amd64 \
|
|
artifacts/mdcms-linux-arm64/mdcms-linux-arm64 \
|
|
artifacts/mdcms-macos-arm64/mdcms-macos-arm64 \
|
|
artifacts/mdcms-windows-amd64/mdcms-windows-amd64.exe \
|
|
artifacts/deb-package-mdcms-linux-amd64/*.deb \
|
|
artifacts/deb-package-mdcms-linux-arm64/*.deb
|