Skip to content

Commit f2aed06

Browse files
authored
Merge pull request #11 from VariableThe/feature/component-refactor-and-math-fixes
CI/CD Pipeline Refactoring and Test Type Fixes
2 parents a8d4f0f + b04e330 commit f2aed06

1 file changed

Lines changed: 64 additions & 11 deletions

File tree

.github/workflows/release.yml

Lines changed: 64 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,85 @@ on:
55
permissions:
66
contents: write
77
jobs:
8-
release:
9-
runs-on: macos-latest
8+
create-tag:
9+
runs-on: ubuntu-latest
10+
outputs:
11+
new_tag: ${{ steps.tag_version.outputs.new_tag }}
12+
new_version: ${{ steps.tag_version.outputs.new_version }}
1013
steps:
1114
- uses: actions/checkout@v4
12-
with:
13-
fetch-depth: 0
14-
- uses: actions/setup-node@v4
15-
with:
16-
node-version: '22'
17-
- run: npm install
1815
- name: Bump version and push tag
1916
id: tag_version
2017
uses: mathieudutour/github-tag-action@v6.2
2118
with:
2219
github_token: ${{ secrets.GITHUB_TOKEN }}
20+
21+
build-and-release:
22+
needs: create-tag
23+
strategy:
24+
matrix:
25+
os: [macos-latest, ubuntu-latest, windows-latest]
26+
runs-on: ${{ matrix.os }}
27+
steps:
28+
- uses: actions/checkout@v4
29+
- uses: actions/setup-node@v4
30+
with:
31+
node-version: '22'
32+
- run: npm install
33+
34+
- name: Sync package.json version
35+
run: npm --no-git-tag-version version ${{ needs.create-tag.outputs.new_version }}
36+
2337
- run: npm run build
24-
- run: npm run package
38+
39+
- name: Build Electron app
40+
run: npx electron-builder
2541
env:
2642
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27-
- name: Create GitHub Release
43+
44+
- name: Upload Release Assets
2845
uses: softprops/action-gh-release@v3
2946
with:
30-
tag_name: ${{ steps.tag_version.outputs.new_tag }}
47+
tag_name: ${{ needs.create-tag.outputs.new_tag }}
48+
fail_on_unmatched_files: false
3149
files: |
3250
release/*.zip
3351
release/*.dmg
3452
release/*.exe
3553
release/*.AppImage
3654
release/*.deb
55+
56+
update-homebrew:
57+
needs: [create-tag, build-and-release]
58+
runs-on: macos-latest
59+
steps:
60+
- name: Checkout Homebrew Tap
61+
uses: actions/checkout@v4
62+
with:
63+
repository: VariableThe/homebrew-tap
64+
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
65+
path: homebrew-tap
66+
67+
- name: Download macOS ZIP
68+
env:
69+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
run: |
71+
VERSION=${{ needs.create-tag.outputs.new_version }}
72+
gh release download v$VERSION --pattern "*.zip" --repo $GITHUB_REPOSITORY
73+
74+
# Calculate SHA256 of the downloaded ZIP
75+
ZIP_FILE=$(ls *.zip | head -n 1)
76+
SHA256=$(shasum -a 256 "$ZIP_FILE" | awk '{ print $1 }')
77+
78+
# Update the rb file
79+
cd homebrew-tap
80+
sed -i '' "s/version \".*\"/version \"$VERSION\"/" Casks/papercache.rb
81+
sed -i '' "s/sha256 arm: * \".*\"/sha256 arm: \"$SHA256\"/" Casks/papercache.rb
82+
sed -i '' "s/PaperCache-[0-9]*\.[0-9]*\.[0-9]*-/PaperCache-#{version}-/g" Casks/papercache.rb
83+
84+
# Commit and Push
85+
git config user.name "github-actions[bot]"
86+
git config user.email "github-actions[bot]@users.noreply.github.com"
87+
git add Casks/papercache.rb
88+
git commit -m "Bump PaperCache to $VERSION" || echo "No changes to commit"
89+
git push

0 commit comments

Comments
 (0)