Skip to content

Commit 5f81ea9

Browse files
author
liuboping
committed
fix(ci): restore Homebrew tap update in release job
The multi-platform matrix refactor (fc53bf6) accidentally deleted the release job containing the Homebrew tap update. Restored with: - Build jobs now upload artifacts (linux, macos, windows zips) - New release job triggers on tag pushes - Downloads artifacts and creates GitHub release - Updates homebrew-lbpssh-tap cask with new version and sha256
1 parent 431364d commit 5f81ea9

File tree

1 file changed

+105
-3
lines changed

1 file changed

+105
-3
lines changed

.github/workflows/ci.yml

Lines changed: 105 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,111 @@ jobs:
2626
sudo apt-get install -y libgtk-3-dev liblzma-dev libstdc++-12-dev
2727
- run: flutter pub get
2828
- run: flutter test
29-
- run: flutter build linux --release
29+
- name: Build Linux
3030
if: matrix.platform == 'ubuntu-latest'
31-
- run: flutter build macos --release
31+
run: |
32+
flutter build linux --release
33+
cd build/linux/x64/release/bundle
34+
zip -r lbpSSH-linux-x64.zip .
35+
- name: Build macOS
36+
if: matrix.platform == 'macos-latest'
37+
run: |
38+
flutter build macos --release --no-tree-shake-icons
39+
cd build/macos/Build/Products/Release
40+
zip -r lbpSSH-macos-universal.zip lbpSSH.app
41+
- name: Build Windows
42+
if: matrix.platform == 'windows-latest'
43+
run: |
44+
flutter build windows --release
45+
Compress-Archive -Path build/windows/x64/runner/Release -DestinationPath build/windows/lbpSSH-windows-x64.zip
46+
- name: Upload Linux build
47+
if: matrix.platform == 'ubuntu-latest'
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: linux-build
51+
path: build/linux/x64/release/bundle/lbpSSH-linux-x64.zip
52+
- name: Upload macOS build
3253
if: matrix.platform == 'macos-latest'
33-
- run: flutter build windows --release
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: macos-build
57+
path: build/macos/Build/Products/Release/lbpSSH-macos-universal.zip
58+
- name: Upload Windows build
3459
if: matrix.platform == 'windows-latest'
60+
uses: actions/upload-artifact@v4
61+
with:
62+
name: windows-build
63+
path: build/windows/lbpSSH-windows-x64.zip
64+
65+
release:
66+
runs-on: ubuntu-latest
67+
needs: build
68+
if: startsWith(github.ref, 'refs/tags/')
69+
permissions:
70+
contents: write
71+
steps:
72+
- uses: actions/checkout@v4
73+
with:
74+
fetch-depth: 0
75+
- name: Download Linux build
76+
uses: actions/download-artifact@v4
77+
with:
78+
name: linux-build
79+
path: releases/
80+
- name: Download Windows build
81+
uses: actions/download-artifact@v4
82+
with:
83+
name: windows-build
84+
path: releases/
85+
- name: Download macOS build
86+
uses: actions/download-artifact@v4
87+
with:
88+
name: macos-build
89+
path: releases/
90+
- name: Get version
91+
id: version
92+
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
93+
- name: Create Release
94+
uses: softprops/action-gh-release@v2
95+
with:
96+
tag_name: ${{ steps.version.outputs.VERSION }}
97+
name: Release ${{ steps.version.outputs.VERSION }}
98+
draft: false
99+
prerelease: false
100+
files: |
101+
releases/**/*
102+
env:
103+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104+
- name: Update Homebrew Tap
105+
env:
106+
VERSION: ${{ steps.version.outputs.VERSION }}
107+
HOMEBREW_TAP_REPO: ${{ secrets.HOMEBREW_TAP_REPO }}
108+
HOMEBREW_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
109+
run: |
110+
if [ -z "$HOMEBREW_TAP_REPO" ]; then
111+
echo "HOMEBREW_TAP_REPO not set, skipping"
112+
exit 0
113+
fi
114+
115+
# Install coreutils for sha256sum
116+
sudo apt-get update
117+
sudo apt-get install -y coreutils
118+
119+
# Clone tap repo
120+
git clone "https://github.com/$HOMEBREW_TAP_REPO.git" /tmp/homebrew-tap
121+
cd /tmp/homebrew-tap
122+
123+
# Calculate sha256 for macOS zip
124+
SHA256=$(sha256sum "$GITHUB_WORKSPACE/releases/lbpSSH-macos-universal.zip" | cut -d' ' -f1)
125+
126+
# Update cask file
127+
perl -i -pe 's/version ".*?"/version "'"$VERSION"'"/' Casks/lbpssh.rb
128+
perl -i -pe 's/sha256 ".*?"/sha256 "'"$SHA256"'"/' Casks/lbpssh.rb
129+
perl -i -pe 's/sha256 :no_check/sha256 "'"$SHA256"'"/' Casks/lbpssh.rb
130+
131+
# Commit and push
132+
git config user.name "GitHub Actions"
133+
git config user.email "actions@github.com"
134+
git add Casks/lbpssh.rb
135+
git commit -m "Update lbpssh to $VERSION"
136+
git push "https://$HOMEBREW_TOKEN@github.com/$HOMEBREW_TAP_REPO.git"

0 commit comments

Comments
 (0)