|
5 | 5 | permissions: |
6 | 6 | contents: write |
7 | 7 | 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 }} |
10 | 13 | steps: |
11 | 14 | - 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 |
18 | 15 | - name: Bump version and push tag |
19 | 16 | id: tag_version |
20 | 17 | uses: mathieudutour/github-tag-action@v6.2 |
21 | 18 | with: |
22 | 19 | 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 | + |
23 | 37 | - run: npm run build |
24 | | - - run: npm run package |
| 38 | + |
| 39 | + - name: Build Electron app |
| 40 | + run: npx electron-builder |
25 | 41 | env: |
26 | 42 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
27 | | - - name: Create GitHub Release |
| 43 | + |
| 44 | + - name: Upload Release Assets |
28 | 45 | uses: softprops/action-gh-release@v3 |
29 | 46 | 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 |
31 | 49 | files: | |
32 | 50 | release/*.zip |
33 | 51 | release/*.dmg |
34 | 52 | release/*.exe |
35 | 53 | release/*.AppImage |
36 | 54 | 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