1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 12:41:46 +00:00
Files
Mole/.github/workflows/release.yml
dependabot[bot] afc0f7b410 chore(deps): bump actions/checkout from 4.3.1 to 6.0.1 (#192)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.3.1 to 6.0.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](34e114876b...8e8c483db8)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 6.0.1
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-29 16:56:18 +08:00

109 lines
3.1 KiB
YAML

name: Release
on:
push:
tags:
- 'V*'
permissions:
contents: write
jobs:
build-release:
runs-on: macos-latest
steps:
- name: Checkout source code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4
- name: Set up Go
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v5
with:
go-version: "1.24.6"
cache: true
- name: Build Universal Binary for disk analyzer
run: ./scripts/build-analyze.sh
- name: Build Universal Binary for system status
run: ./scripts/build-status.sh
- name: Verify binary is valid
run: |
if [[ ! -x bin/analyze-go ]]; then
echo "Error: bin/analyze-go is not executable"
exit 1
fi
if [[ ! -x bin/status-go ]]; then
echo "Error: bin/status-go is not executable"
exit 1
fi
echo "Binary info:"
file bin/analyze-go
ls -lh bin/analyze-go
file bin/status-go
ls -lh bin/status-go
echo ""
echo "✓ Universal binary built successfully"
- name: Commit binaries for release
run: |
# Configure Git
git config user.name "Tw93"
git config user.email "tw93@qq.com"
# Save binaries to temp location
cp bin/analyze-go /tmp/analyze-go
cp bin/status-go /tmp/status-go
# Switch to main branch
git fetch origin main
git checkout main
git pull origin main
# Restore binaries
mv /tmp/analyze-go bin/analyze-go
mv /tmp/status-go bin/status-go
# Commit and Push
git add bin/analyze-go bin/status-go
if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit -m "chore: update binaries for ${GITHUB_REF#refs/tags/}"
git push origin main
fi
update-formula:
runs-on: ubuntu-latest
needs: build-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 }}"