Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 38 additions & 27 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,8 @@ permissions:
contents: write

jobs:
create-release:
name: Ensure Release Exists
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Create or Update GitHub Release Header
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || 'canary' }}
name: ${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || 'Canary Build' }}
draft: false
prerelease: ${{ !startsWith(github.ref, 'refs/tags/v') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build-and-upload:
name: Build & Upload on ${{ matrix.os }}
needs: create-release
build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -56,23 +38,52 @@ jobs:
fi
shell: bash

- name: Upload Release Artifacts
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-${{ matrix.os }}
path: artifacts/
retention-days: 1

release:
name: Create GitHub Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Download All Build Artifacts
uses: actions/download-artifact@v4
with:
path: all-artifacts

- name: Flatten Artifacts Directory
run: |
mkdir -p dist-artifacts
find all-artifacts -type f -exec cp -v {} dist-artifacts/ \;
echo "Files to upload:"
ls -l dist-artifacts

- name: Create or Update GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || 'canary' }}
files: artifacts/*
fail_on_unmatched_files: false
name: ${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || 'Canary Build' }}
draft: false
prerelease: ${{ !startsWith(github.ref, 'refs/tags/v') }}
files: dist-artifacts/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Calculate sha256
if: matrix.os == 'macos-latest' && startsWith(github.ref, 'refs/tags/v')
- name: Calculate sha256 of macOS DMG
if: startsWith(github.ref, 'refs/tags/v')
id: sha
run: |
echo "hash=$(shasum -a 256 artifacts/stable-macos-arm64-yafw.dmg | awk '{print $1}')" >> $GITHUB_OUTPUT
echo "hash=$(sha256sum dist-artifacts/stable-macos-arm64-yafw.dmg | awk '{print $1}')" >> $GITHUB_OUTPUT

- name: Update Homebrew Tap (Cask)
if: matrix.os == 'macos-latest' && startsWith(github.ref, 'refs/tags/v')
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/github-script@v7
with:
github-token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
Expand Down
Loading