Skip to content

Merge branch 'main' of https://github.com/themuffinator/PakFu #17

Merge branch 'main' of https://github.com/themuffinator/PakFu

Merge branch 'main' of https://github.com/themuffinator/PakFu #17

Workflow file for this run

name: auto-version
on:
push:
branches:
- main
workflow_dispatch:
inputs:
channel:
description: Release channel
required: true
default: dev
type: choice
options:
- stable
- beta
- dev
permissions:
contents: write
actions: write
concurrency:
group: auto-version
cancel-in-progress: false
jobs:
tag:
if: >
github.actor != 'github-actions[bot]' &&
(github.event_name == 'workflow_dispatch' ||
!contains(github.event.head_commit.message, 'chore(release):'))
runs-on: ubuntu-latest
outputs:
tagged: ${{ steps.tag.outputs.tagged }}
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Compute Version
id: version
shell: bash
run: |
channel="${{ github.event.inputs.channel }}"
if [[ -z "$channel" ]]; then
channel="dev"
fi
version="$(python scripts/next_version.py --channel "$channel" --write)"
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Update Changelog
shell: bash
run: |
python scripts/update_changelog.py --version "${{ steps.version.outputs.version }}"
- name: Commit and Tag
id: tag
shell: bash
run: |
echo "tagged=false" >> "$GITHUB_OUTPUT"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add VERSION CHANGELOG.md
if git diff --cached --quiet; then
echo "VERSION unchanged; nothing to tag."
exit 0
fi
git commit -m "chore(release): v${{ steps.version.outputs.version }} [skip release]"
git tag "v${{ steps.version.outputs.version }}"
git push
git push --tags
echo "tagged=true" >> "$GITHUB_OUTPUT"
build:
needs: tag
if: needs.tag.outputs.tagged == 'true'
name: build-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout Release Tag
shell: bash
run: |
git fetch --tags --force
git checkout "v${{ needs.tag.outputs.version }}"
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install Meson + Ninja
run: python -m pip install --upgrade pip meson ninja
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: "6.10.1"
arch: ${{ matrix.os == 'windows-latest' && 'win64_msvc2022_64' || matrix.os == 'macos-latest' && 'clang_64' || 'gcc_64' }}
- name: Determine Update Channel
shell: bash
run: |
version="$(cat VERSION)"
if [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "PAKFU_UPDATE_CHANNEL=dev" >> "$GITHUB_ENV"
else
echo "PAKFU_UPDATE_CHANNEL=stable" >> "$GITHUB_ENV"
fi
- name: Configure
run: meson setup builddir --backend ninja -Dgithub_repo=${{ github.repository }} -Dupdate_channel=$PAKFU_UPDATE_CHANNEL
- name: Build
run: meson compile -C builddir
- name: Package (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: ./scripts/package_windows.ps1
- name: Package (macOS)
if: matrix.os == 'macos-latest'
shell: bash
run: bash scripts/package_macos.sh
- name: Package (Linux)
if: matrix.os == 'ubuntu-latest'
shell: bash
run: bash scripts/package_linux.sh
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: pakfu-${{ matrix.os }}
path: |
dist/*.zip
dist/*.tar.gz
dist/*.tgz
dist/*.tar.xz
dist/*.AppImage
dist/*.dmg
dist/*.pkg
dist/*.exe
dist/*.msi
release:
needs: [tag, build]
if: needs.tag.outputs.tagged == 'true'
name: github-release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout Release Tag
shell: bash
run: |
git fetch --tags --force
git checkout "v${{ needs.tag.outputs.version }}"
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Resolve Version
shell: bash
run: |
version="$(cat VERSION)"
echo "PAKFU_VERSION=$version" >> "$GITHUB_ENV"
- name: Determine Release Type
shell: bash
run: |
version="${PAKFU_VERSION}"
if [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "PAKFU_PRERELEASE=true" >> "$GITHUB_ENV"
else
echo "PAKFU_PRERELEASE=false" >> "$GITHUB_ENV"
fi
- name: Prepare Release Notes
shell: bash
run: |
python scripts/release_notes.py --version "v${PAKFU_VERSION}" --output release_notes.md
- name: Publish Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ env.PAKFU_VERSION }}
name: v${{ env.PAKFU_VERSION }}
files: dist/**
body_path: release_notes.md
generate_release_notes: false
fail_on_unmatched_files: true
prerelease: ${{ env.PAKFU_PRERELEASE == 'true' }}