mirror of
https://github.com/tw93/Mole.git
synced 2026-02-12 19:15:13 +00:00
Automatic packaging at the time of tag
This commit is contained in:
92
.github/workflows/release.yml
vendored
Normal file
92
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'V*'
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-release:
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout source code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@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: |
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
|
git add bin/analyze-go bin/status-go
|
||||||
|
if git diff --staged --quiet; then
|
||||||
|
echo "No binary changes to commit"
|
||||||
|
else
|
||||||
|
git commit -m "chore: update binaries for ${GITHUB_REF#refs/tags/}"
|
||||||
|
git push origin HEAD: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@v3
|
||||||
|
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 }}"
|
||||||
46
.github/workflows/shell-quality-checks.yml
vendored
46
.github/workflows/shell-quality-checks.yml
vendored
@@ -53,49 +53,3 @@ jobs:
|
|||||||
echo "Test summary:"
|
echo "Test summary:"
|
||||||
echo " Total test files: $(ls tests/*.bats | wc -l | tr -d ' ')"
|
echo " Total test files: $(ls tests/*.bats | wc -l | tr -d ' ')"
|
||||||
echo " Total tests: $(grep -c "^@test" tests/*.bats | awk -F: '{sum+=$2} END {print sum}')"
|
echo " Total tests: $(grep -c "^@test" tests/*.bats | awk -F: '{sum+=$2} END {print sum}')"
|
||||||
|
|
||||||
- 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 analyzer binary if updated
|
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
run: |
|
|
||||||
if git diff --quiet -- bin/analyze-go; then
|
|
||||||
echo "bin/analyze-go unchanged; nothing to commit."
|
|
||||||
else
|
|
||||||
git config user.name "github-actions[bot]"
|
|
||||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
||||||
git add bin/analyze-go
|
|
||||||
git commit -m "chore: update analyzer binary"
|
|
||||||
git push origin HEAD:${GITHUB_REF#refs/heads/}
|
|
||||||
fi
|
|
||||||
if git diff --quiet -- bin/status-go; then
|
|
||||||
echo "bin/status-go unchanged; nothing to commit."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
git config user.name "github-actions[bot]"
|
|
||||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
||||||
git add bin/status-go
|
|
||||||
git commit -m "chore: update status binary"
|
|
||||||
git push origin HEAD:${GITHUB_REF#refs/heads/}
|
|
||||||
|
|||||||
40
.github/workflows/update-homebrew.yml
vendored
40
.github/workflows/update-homebrew.yml
vendored
@@ -1,40 +0,0 @@
|
|||||||
name: Update Homebrew Formula
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'V*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
update-formula:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
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@v3
|
|
||||||
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 }}"
|
|
||||||
Reference in New Issue
Block a user