Files
marcer-gamedvd-launcher/.github/workflows/release.yml
T
2026-08-10 20:20:27 +02:00

98 lines
2.9 KiB
YAML

name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
include:
- os: windows-latest
rid: win-x64
artifact_name: win-x64
- os: ubuntu-latest
rid: linux-x64
artifact_name: linux-x64
- os: macos-latest
rid: osx-x64
artifact_name: osx-x64
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Get version from tag
id: version
shell: bash
run: |
VERSION="${GITHUB_REF_NAME#v}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Build
run: dotnet publish -c Release -r ${{ matrix.rid }} -p:Version=${{ steps.version.outputs.version }} --self-contained false
- name: Create ZIP (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
Compress-Archive -Path "MarcerGameDvdLauncher/bin/Release/net10.0/${{ matrix.rid }}/*" -DestinationPath "MarcerGameDvdLauncher-v${{ steps.version.outputs.version }}-${{ matrix.artifact_name }}.zip"
- name: Create ZIP (Linux/macOS)
if: matrix.os != 'windows-latest'
run: |
cd MarcerGameDvdLauncher/bin/Release/net10.0/${{ matrix.rid }}
zip -r ../../../MarcerGameDvdLauncher-v${{ steps.version.outputs.version }}-${{ matrix.artifact_name }}.zip .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: MarcerGameDvdLauncher-v${{ steps.version.outputs.version }}-${{ matrix.artifact_name }}
path: MarcerGameDvdLauncher-v${{ steps.version.outputs.version }}-${{ matrix.artifact_name }}.zip
release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Generate release notes
shell: bash
run: |
CURRENT_TAG="${GITHUB_REF_NAME}"
PREV_TAG=$(git describe --tags --abbrev=0 ${CURRENT_TAG}^ 2>/dev/null || echo "")
if [ -n "$PREV_TAG" ]; then
echo "## Changes since ${PREV_TAG}" > release-notes.md
echo "" >> release-notes.md
git log --oneline ${PREV_TAG}..${CURRENT_TAG} >> release-notes.md
else
echo "## Initial release" > release-notes.md
fi
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: MarcerGameDvdLauncher ${{ github.ref_name }}
body_path: release-notes.md
files: artifacts/**/*.zip
generate_release_notes: false