trying to fix the github actions issues #6
Workflow file for this run
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: Build and Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: ubuntu-22.04 | |
| target: x86_64-unknown-linux-gnu | |
| artifact_name: spent_amd64.deb | |
| artifact_path: src-tauri/target/release/bundle/deb/*.deb | |
| appimage_path: src-tauri/target/release/bundle/appimage/*.AppImage* | |
| - platform: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| artifact_name: spent_x64-setup.exe | |
| artifact_path: src-tauri/target/release/bundle/nsis/*setup*.exe | |
| - platform: macos-latest | |
| target: x86_64-apple-darwin | |
| artifact_name: spent.app.tar.gz | |
| artifact_path: src-tauri/target/release/bundle/macos/*.app | |
| - platform: macos-latest | |
| target: aarch64-apple-darwin | |
| artifact_name: spent_aarch64.app.tar.gz | |
| artifact_path: src-tauri/target/release/bundle/macos/*.app | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install Linux dependencies | |
| if: matrix.platform == 'ubuntu-22.04' | |
| 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 \ | |
| libfuse2 | |
| wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage | |
| chmod +x linuxdeploy-x86_64.AppImage | |
| ./linuxdeploy-x86_64.AppImage --appimage-extract | |
| mkdir -p ~/.local/bin | |
| mv squashfs-root/AppRun ~/.local/bin/linuxdeploy | |
| chmod +x ~/.local/bin/linuxdeploy | |
| echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/registry | |
| key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo index | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo build | |
| uses: actions/cache@v4 | |
| with: | |
| path: src-tauri/target | |
| key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Install frontend dependencies | |
| run: npm ci | |
| - name: Build Tauri app | |
| run: npm run tauri build -- --target ${{ matrix.target }} | |
| - name: Upload .deb artifact (Linux) | |
| if: matrix.platform == 'ubuntu-22.04' | |
| continue-on-error: true | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: spent-linux-deb | |
| path: ${{ matrix.artifact_path }} | |
| if-no-files-found: warn | |
| - name: Upload .AppImage artifact (Linux) | |
| if: matrix.platform == 'ubuntu-22.04' | |
| continue-on-error: true | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: spent-linux-appimage | |
| path: ${{ matrix.appimage_path }} | |
| if-no-files-found: warn | |
| - name: Upload .exe artifact (Windows) | |
| if: matrix.platform == 'windows-latest' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: spent-windows-exe | |
| path: ${{ matrix.artifact_path }} | |
| - name: Archive macOS app | |
| if: matrix.platform == 'macos-latest' | |
| run: | | |
| cd src-tauri/target/${{ matrix.target }}/release/bundle/macos | |
| tar -czf spent.app.tar.gz *.app | |
| - name: Upload macOS artifact | |
| if: matrix.platform == 'macos-latest' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: spent-macos-${{ matrix.target }} | |
| path: src-tauri/target/${{ matrix.target }}/release/bundle/macos/spent.app.tar.gz | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| artifacts/**/*.deb | |
| artifacts/**/*.AppImage | |
| artifacts/**/*.exe | |
| artifacts/**/*.tar.gz | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| aur-publish: | |
| needs: release | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Extract version from tag | |
| id: get_version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| - name: Update PKGBUILD version | |
| run: | | |
| cd AUR | |
| sed -i "s/^pkgver=.*/pkgver=${{ steps.get_version.outputs.VERSION }}/" PKGBUILD | |
| sed -i "s/^pkgrel=.*/pkgrel=1/" PKGBUILD | |
| - name: Update checksum | |
| run: | | |
| cd AUR | |
| SHA256=$(curl -sL "https://github.com/FrogSnot/Spent/archive/v${{ steps.get_version.outputs.VERSION }}.tar.gz" | sha256sum | awk '{print $1}') | |
| sed -i "s/^sha256sums=.*/sha256sums=('$SHA256')/" PKGBUILD | |
| - name: Generate .SRCINFO | |
| uses: Morganamilo/actions-makepkg@v2 | |
| with: | |
| pkgdir: AUR | |
| command: makepkg --printsrcinfo > .SRCINFO | |
| - name: Publish to AUR | |
| uses: KSXGitHub/github-actions-deploy-aur@v2.7.0 | |
| with: | |
| pkgname: spent | |
| pkgbuild: AUR/PKGBUILD | |
| commit_username: ${{ secrets.AUR_USERNAME }} | |
| commit_email: ${{ secrets.AUR_EMAIL }} | |
| ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} | |
| commit_message: "Update to version ${{ steps.get_version.outputs.VERSION }}" |