mirror of
https://github.com/tw93/Mole.git
synced 2026-02-04 14:26:46 +00:00
- Add packaging step to create binaries-darwin-{arch}.tar.gz
- These packages will be downloaded by Homebrew resource mechanism
- Enables faster installation without Go dependency
- Separate packages for arm64 and amd64 architectures
114 lines
3.3 KiB
YAML
114 lines
3.3 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'V*'
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build:
|
|
name: Build
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- os: macos-latest
|
|
target: release-amd64
|
|
artifact_name: binaries-amd64
|
|
- os: macos-latest
|
|
target: release-arm64
|
|
artifact_name: binaries-arm64
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v5
|
|
with:
|
|
go-version: "1.24.6"
|
|
|
|
- name: Build Binaries
|
|
run: |
|
|
make ${{ matrix.target }}
|
|
ls -l bin/
|
|
|
|
- name: Package binaries for Homebrew
|
|
run: |
|
|
cd bin
|
|
# Package binaries into tar.gz for Homebrew resource
|
|
if [[ "${{ matrix.target }}" == "release-arm64" ]]; then
|
|
tar -czf binaries-darwin-arm64.tar.gz analyze-darwin-arm64 status-darwin-arm64
|
|
ls -lh binaries-darwin-arm64.tar.gz
|
|
else
|
|
tar -czf binaries-darwin-amd64.tar.gz analyze-darwin-amd64 status-darwin-amd64
|
|
ls -lh binaries-darwin-amd64.tar.gz
|
|
fi
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
|
with:
|
|
name: ${{ matrix.artifact_name }}
|
|
path: bin/*-darwin-*
|
|
retention-days: 1
|
|
|
|
release:
|
|
name: Publish Release
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
|
|
with:
|
|
path: bin
|
|
pattern: binaries-*
|
|
merge-multiple: true
|
|
|
|
- name: Display structure of downloaded files
|
|
run: ls -R bin/
|
|
|
|
- name: Create Release
|
|
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
with:
|
|
files: bin/*
|
|
generate_release_notes: true
|
|
draft: false
|
|
prerelease: false
|
|
|
|
update-formula:
|
|
runs-on: ubuntu-latest
|
|
needs: release
|
|
steps:
|
|
- name: Extract version from tag
|
|
id: tag_version
|
|
run: |
|
|
TAG=${GITHUB_REF#refs/tags/}
|
|
VERSION=${TAG#V}
|
|
echo "tag=$TAG" >> $GITHUB_OUTPUT
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
echo "Releasing version: $VERSION (tag: $TAG)"
|
|
|
|
- name: Update Homebrew formula
|
|
uses: mislav/bump-homebrew-formula-action@56a283fa15557e9abaa4bdb63b8212abc68e655c # v3.6
|
|
with:
|
|
formula-name: mole
|
|
formula-path: Formula/mole.rb
|
|
homebrew-tap: tw93/homebrew-tap
|
|
tag-name: ${{ steps.tag_version.outputs.tag }}
|
|
commit-message: |
|
|
mole ${{ steps.tag_version.outputs.version }}
|
|
|
|
Automated release via GitHub Actions
|
|
env:
|
|
COMMITTER_TOKEN: ${{ secrets.PAT_TOKEN }}
|
|
|
|
- name: Verify formula update
|
|
if: success()
|
|
run: |
|
|
echo "✓ Homebrew formula updated successfully"
|
|
echo " Version: ${{ steps.tag_version.outputs.version }}"
|
|
echo " Tag: ${{ steps.tag_version.outputs.tag }}"
|