fix: resolve remaining clippy warnings #19
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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| prepare: | |
| name: Prepare Version | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| outputs: | |
| new_version: ${{ steps.bump.outputs.new_version }} | |
| version_only: ${{ steps.bump.outputs.version_only }} | |
| sha: ${{ steps.commit.outputs.sha }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Calculate Version | |
| id: bump | |
| run: | | |
| NEW_VERSION="${{ github.ref_name }}" | |
| VERSION_ONLY="${NEW_VERSION#v}" | |
| echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT | |
| echo "version_only=$VERSION_ONLY" >> $GITHUB_OUTPUT | |
| - name: Update Cargo.toml | |
| run: | | |
| VERSION="${{ steps.bump.outputs.version_only }}" | |
| awk '/^\[package\]/ {print; p=1; next} p && /^version =/ {print "version = \"'$VERSION'\""; p=0; next} {print}' Cargo.toml > Cargo.toml.tmp && mv Cargo.toml.tmp Cargo.toml | |
| cargo update --workspace | |
| - name: Commit and Push | |
| id: commit | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git add Cargo.toml Cargo.lock | |
| if [ -z "$(git status --porcelain)" ]; then | |
| echo "nothing to commit" | |
| else | |
| git commit -m "chore: bump version to ${{ steps.bump.outputs.new_version }}" | |
| git push origin HEAD:master | |
| fi | |
| echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
| build: | |
| name: Build (${{ matrix.suffix }}) | |
| needs: prepare | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| actions: read | |
| id-token: none | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| cpu: generic | |
| suffix: x86_64 | |
| - target: x86_64-unknown-linux-gnu | |
| cpu: x86-64-v3 | |
| suffix: x86_64-v3 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ needs.prepare.outputs.sha }} | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libgtk-4-dev libvte-2.91-gtk4-dev | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Rust Cache | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Build (Performance optimized) | |
| run: | | |
| export RUSTFLAGS="-C target-cpu=${{ matrix.cpu }}" | |
| if [ "${{ matrix.cpu }}" = "generic" ]; then export RUSTFLAGS=""; fi | |
| cargo build --release --target ${{ matrix.target }} | |
| - name: Prepare binary | |
| run: | | |
| cd target/${{ matrix.target }}/release | |
| strip rustmius || true | |
| mv rustmius rustmius-${{ matrix.suffix }} | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: binary-${{ matrix.suffix }} | |
| path: target/${{ matrix.target }}/release/rustmius-${{ matrix.suffix }} | |
| deb: | |
| name: Build .deb (Debian/Ubuntu) | |
| needs: [prepare, build] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ needs.prepare.outputs.sha }} | |
| - name: Install packaging dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libgtk-4-dev libvte-2.91-gtk4-dev dpkg-dev imagemagick | |
| - name: Download prebuilt generic binary | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: binary-x86_64 | |
| path: prebuilt | |
| - name: Stage binary for packaging | |
| run: | | |
| mkdir -p target/release | |
| install -m755 prebuilt/rustmius-x86_64 target/release/rustmius | |
| - name: Build .deb package | |
| env: | |
| SKIP_BUILD: "1" | |
| run: ./packages/deb/build-deb.sh | |
| - name: Upload .deb artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: deb | |
| path: dist/*.deb | |
| release: | |
| name: Create Release | |
| needs: [prepare, build, deb] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download binary artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| path: artifacts | |
| pattern: binary-* | |
| merge-multiple: true | |
| - name: Download .deb artifact | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: deb | |
| path: artifacts | |
| - name: Release | |
| uses: softprops/action-gh-release@v3 | |
| with: | |
| tag_name: ${{ needs.prepare.outputs.new_version }} | |
| target_commitish: ${{ needs.prepare.outputs.sha }} | |
| files: | | |
| artifacts/rustmius-* | |
| artifacts/*.deb | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| aur: | |
| name: Update AUR (${{ matrix.package }}) | |
| needs: [prepare, build] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| strategy: | |
| matrix: | |
| package: [rustmius, rustmius-bin] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Download Artifacts | |
| if: matrix.package == 'rustmius-bin' | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: binary-x86_64 | |
| path: . | |
| - name: Update PKGBUILD (rustmius-bin) | |
| if: matrix.package == 'rustmius-bin' | |
| run: | | |
| VERSION="${{ needs.prepare.outputs.version_only }}" | |
| # Paths updated to packages/ subdirectory | |
| HASH_DESKTOP=$(sha256sum packages/org.rustmius.Rustmius.desktop | cut -d' ' -f1) | |
| HASH_PNG=$(sha256sum packages/rustmius.png | cut -d' ' -f1) | |
| HASH_LICENSE=$(sha256sum LICENSE | cut -d' ' -f1) | |
| HASH_BINARY=$(sha256sum rustmius-x86_64 | cut -d' ' -f1) | |
| # Target the specific PKGBUILD in packages/rustmius-bin/ | |
| TARGET="packages/rustmius-bin/PKGBUILD" | |
| awk -v v="$VERSION" -v d="$HASH_DESKTOP" -v p="$HASH_PNG" -v l="$HASH_LICENSE" -v b="$HASH_BINARY" ' | |
| BEGIN { h[0]=d; h[1]=p; h[2]=l; h[3]=b; i=0 } | |
| /^pkgver=/ { $0="pkgver=" v } | |
| /^pkgrel=/ { $0="pkgrel=1" } | |
| /^pkgdesc=/ { $0="pkgdesc=\"Full local Termius alternative for Linux (GTK4) - binary release\"" } | |
| /'\''[0-9a-f]{64}'\''/ && i < 4 { | |
| sub(/'\''[0-9a-f]{64}'\''/, "'\''" h[i++] "'\''") | |
| } | |
| { print } | |
| ' "$TARGET" > "$TARGET.tmp" && mv "$TARGET.tmp" "$TARGET" | |
| - name: Update PKGBUILD (rustmius) | |
| if: matrix.package == 'rustmius' | |
| run: | | |
| VERSION="${{ needs.prepare.outputs.version_only }}" | |
| # Get source archive hash | |
| URL="https://github.com/Cleboost/Rustmius/archive/v$VERSION.tar.gz" | |
| curl -L -o source.tar.gz "$URL" | |
| HASH_SOURCE=$(sha256sum source.tar.gz | cut -d' ' -f1) | |
| TARGET="packages/rustmius/PKGBUILD" | |
| sed -i "s/^pkgver=.*/pkgver=$VERSION/" "$TARGET" | |
| sed -i "s/^pkgrel=.*/pkgrel=1/" "$TARGET" | |
| sed -i "s/^pkgdesc=.*/pkgdesc=\"Full local Termius alternative for Linux (GTK4) - built from stable source\"/" "$TARGET" | |
| # Update the source hash (it's the only hash in this PKGBUILD) | |
| sed -i "s/sha256sums=('.*')/sha256sums=('$HASH_SOURCE')/" "$TARGET" | |
| - name: Commit and Push PKGBUILDs | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git add packages/ | |
| if [ -z "$(git status --porcelain)" ]; then | |
| echo "nothing to commit" | |
| else | |
| git commit -m "chore: update PKGBUILDs to ${{ needs.prepare.outputs.new_version }}" | |
| git pull --rebase origin master | |
| git push origin HEAD:master | |
| fi | |
| - name: Publish AUR package | |
| uses: KSXGitHub/github-actions-deploy-aur@v4.2.0 | |
| with: | |
| pkgname: ${{ matrix.package }} | |
| pkgbuild: ./packages/${{ matrix.package }}/PKGBUILD | |
| commit_username: ${{ secrets.AUR_USERNAME }} | |
| commit_email: ${{ secrets.AUR_EMAIL }} | |
| ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} | |
| commit_message: "Update to ${{ needs.prepare.outputs.new_version }}" | |
| ssh_keyscan_types: rsa,ecdsa,ed25519 |