chore: release 0.5.0 #10
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: Nightly Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'src/**' | |
| - 'Cargo.toml' | |
| - 'Cargo.lock' | |
| workflow_dispatch: # Allow manual trigger | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.target }} | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: read | |
| strategy: | |
| matrix: | |
| include: | |
| - target: x86_64-apple-darwin | |
| os: macos-latest | |
| - target: aarch64-apple-darwin | |
| os: macos-latest | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| - target: aarch64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@f7ccc83f9ed1e5b9c81d8a67d7ad1a747e22a561 # stable | |
| with: | |
| toolchain: stable | |
| targets: ${{ matrix.target }} | |
| - name: Cache Cargo | |
| uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ matrix.target }}-cargo- | |
| - name: Cache cross | |
| id: cache-cross | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' | |
| uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2 | |
| with: | |
| path: ~/.cargo/bin/cross | |
| key: cross-${{ runner.os }}-${{ runner.arch }} | |
| - name: Install cross (Linux ARM) | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' && steps.cache-cross.outputs.cache-hit != 'true' | |
| run: cargo install cross --locked | |
| - name: Build (cross) | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' | |
| run: cross build --release --target ${{ matrix.target }} | |
| - name: Build (native) | |
| if: matrix.target != 'aarch64-unknown-linux-gnu' | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Package | |
| shell: bash | |
| run: | | |
| cd target/${{ matrix.target }}/release | |
| tar -czvf ../../../weasel-${{ matrix.target }}.tar.gz weasel | |
| cd ../../.. | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| with: | |
| name: weasel-${{ matrix.target }} | |
| path: weasel-${{ matrix.target }}.tar.gz | |
| retention-days: 1 | |
| release: | |
| name: Create Nightly Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| id-token: write | |
| attestations: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Get version and date | |
| id: version | |
| run: | | |
| DATE=$(date +%Y%m%d) | |
| SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7) | |
| echo "tag=nightly-${DATE}-${SHORT_SHA}" >> "$GITHUB_OUTPUT" | |
| echo "name=Nightly ${DATE}" >> "$GITHUB_OUTPUT" | |
| - name: Download artifacts | |
| uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| path: artifacts | |
| - name: Generate Checksums | |
| run: | | |
| cd artifacts | |
| find . -name "*.tar.gz" -exec sha256sum {} \; | sed 's| \./| |' > ../checksums.txt | |
| cat ../checksums.txt | |
| - name: Delete existing nightly tag | |
| continue-on-error: true | |
| run: git push origin :refs/tags/${{ steps.version.outputs.tag }} | |
| - name: Create Release | |
| uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0 | |
| with: | |
| tag_name: ${{ steps.version.outputs.tag }} | |
| name: ${{ steps.version.outputs.name }} | |
| files: | | |
| artifacts/**/*.tar.gz | |
| checksums.txt | |
| prerelease: true | |
| body: | | |
| ## Nightly Build | |
| This is an automated nightly build from the `main` branch. | |
| **Commit:** ${{ github.sha }} | |
| **Date:** ${{ steps.version.outputs.tag }} | |
| > ⚠️ This is a pre-release build and may be unstable. | |
| ### Verification | |
| ```bash | |
| # Verify checksums | |
| sha256sum -c checksums.txt | |
| # Verify attestation (requires gh CLI) | |
| gh attestation verify weasel-<target>.tar.gz --owner slvDev | |
| ``` | |
| ### Installation | |
| ```bash | |
| # Using weaselup (will install latest stable) | |
| curl -sSL https://raw.githubusercontent.com/slvDev/weasel/main/weaselup/install | bash | |
| # Or download this nightly directly | |
| # macOS (Apple Silicon) | |
| curl -sSL https://github.com/slvDev/weasel/releases/download/${{ steps.version.outputs.tag }}/weasel-aarch64-apple-darwin.tar.gz | tar xz | |
| # macOS (Intel) | |
| curl -sSL https://github.com/slvDev/weasel/releases/download/${{ steps.version.outputs.tag }}/weasel-x86_64-apple-darwin.tar.gz | tar xz | |
| # Linux (x86_64) | |
| curl -sSL https://github.com/slvDev/weasel/releases/download/${{ steps.version.outputs.tag }}/weasel-x86_64-unknown-linux-gnu.tar.gz | tar xz | |
| ``` | |
| - name: Attest Build Provenance | |
| uses: actions/attest-build-provenance@00014ed6ed5efc5b1ab7f7f34a39eb55d41aa4f8 # v3.1.0 | |
| with: | |
| subject-path: artifacts/**/*.tar.gz | |
| - name: Cleanup Old Nightlies | |
| run: | | |
| # Keep last 7 nightly releases | |
| gh release list --limit 100 | grep 'nightly-' | tail -n +8 | \ | |
| awk '{print $1}' | xargs -I {} gh release delete {} -y --cleanup-tag || true | |
| env: | |
| GH_TOKEN: ${{ github.token }} |