Handy/.github/workflows/release.yml
2025-08-19 19:10:16 -07:00

83 lines
2.5 KiB
YAML

name: "Release"
on: workflow_dispatch
jobs:
create-release:
permissions:
contents: write
runs-on: ubuntu-latest
outputs:
release-id: ${{ steps.create-release.outputs.result }}
version: ${{ steps.determine-version.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Determine Version
id: determine-version
shell: bash
run: |
APP_VERSION=""
REF="${{ github.ref }}"
if [[ "$REF" == refs/tags/v* ]]; then
APP_VERSION="${REF#refs/tags/v}"
echo "Release version determined from tag: $APP_VERSION"
else
DESCRIBE=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
APP_VERSION="${DESCRIBE#v}"
echo "CI version determined from latest tag or fallback: $APP_VERSION"
fi
echo "version=${APP_VERSION}" >> "$GITHUB_OUTPUT"
- name: Create Draft Release
id: create-release
uses: actions/github-script@v7
with:
script: |
const { data } = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: `v${{ steps.determine-version.outputs.version }}`,
name: `v${{ steps.determine-version.outputs.version }}`,
draft: true,
prerelease: false,
generate_release_notes: true
})
return data.id
publish-tauri:
permissions:
contents: write
needs: create-release
strategy:
fail-fast: false
matrix:
include:
- platform: "macos-latest" # for Arm based macs (M1 and above).
args: "--target aarch64-apple-darwin"
target: "aarch64-apple-darwin"
- platform: "macos-latest" # for Intel based macs.
args: "--target x86_64-apple-darwin"
target: "x86_64-apple-darwin"
- platform: "ubuntu-22.04"
args: ""
target: "x86_64-unknown-linux-gnu"
- platform: "windows-latest"
args: ""
target: "x86_64-pc-windows-msvc"
uses: ./.github/workflows/build.yml
with:
platform: ${{ matrix.platform }}
target: ${{ matrix.target }}
build-args: ${{ matrix.args }}
sign-binaries: true
asset-prefix: "handy"
upload-artifacts: false
release-id: ${{ needs.create-release.outputs.release-id }}
secrets: inherit