Merge pull request #77 from VariableThe/feat/keybinds-and-timers-v0.5.6 #84
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| create-tag: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| new_tag: ${{ steps.get_version.outputs.new_tag }} | |
| new_version: ${{ steps.get_version.outputs.new_version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get version from package.json | |
| id: get_version | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| echo "new_version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "new_tag=v$VERSION" >> $GITHUB_OUTPUT | |
| - name: Create and push tag | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git tag -a "v${{ steps.get_version.outputs.new_version }}" -m "Release v${{ steps.get_version.outputs.new_version }}" || echo "Tag already exists" | |
| git push origin "v${{ steps.get_version.outputs.new_version }}" || echo "Tag already pushed" | |
| build-and-release: | |
| needs: create-tag | |
| strategy: | |
| matrix: | |
| os: [macos-latest, ubuntu-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install dependencies (Ubuntu only) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential curl wget file libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - run: npm ci | |
| - name: Build and Upload Tauri App | |
| uses: tauri-apps/tauri-action@v0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} | |
| TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} | |
| with: | |
| tagName: ${{ needs.create-tag.outputs.new_tag }} | |
| releaseName: 'PaperCache ${{ needs.create-tag.outputs.new_tag }}' | |
| releaseBody: 'See the assets to download this version and install.' | |
| releaseDraft: false | |
| prerelease: false | |
| update-homebrew: | |
| needs: [create-tag, build-and-release] | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout Homebrew Tap | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: VariableThe/homebrew-tap | |
| token: ${{ secrets.HOMEBREW_TAP_TOKEN }} | |
| path: homebrew-tap | |
| - name: Download macOS App | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| VERSION=${{ needs.create-tag.outputs.new_version }} | |
| gh release download v$VERSION --pattern "*aarch64.app.tar.gz" --repo $GITHUB_REPOSITORY | |
| # Calculate SHA256 of the downloaded archive | |
| APP_FILE=$(ls *aarch64.app.tar.gz | head -n 1) | |
| SHA256=$(shasum -a 256 "$APP_FILE" | awk '{ print $1 }') | |
| # Update the rb file | |
| cd homebrew-tap | |
| sed -i '' "s/url .*/url \"https:\/\/github.com\/VariableThe\/PaperCache\/releases\/download\/v$VERSION\/$APP_FILE\"/" Casks/papercache.rb | |
| sed -i '' "s/version \".*\"/version \"$VERSION\"/" Casks/papercache.rb | |
| sed -i '' "s/sha256 arm: * \".*\"/sha256 arm: \"$SHA256\"/" Casks/papercache.rb | |
| # Commit and Push | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add Casks/papercache.rb | |
| git commit -m "Bump PaperCache to $VERSION" || echo "No changes to commit" | |
| git push |