|
| 1 | +name: Nightly Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + paths: |
| 8 | + - 'src/**' |
| 9 | + - 'Cargo.toml' |
| 10 | + - 'Cargo.lock' |
| 11 | + workflow_dispatch: # Allow manual trigger |
| 12 | + |
| 13 | +env: |
| 14 | + CARGO_TERM_COLOR: always |
| 15 | + |
| 16 | +jobs: |
| 17 | + build: |
| 18 | + name: Build ${{ matrix.target }} |
| 19 | + runs-on: ${{ matrix.os }} |
| 20 | + strategy: |
| 21 | + matrix: |
| 22 | + include: |
| 23 | + - target: x86_64-apple-darwin |
| 24 | + os: macos-latest |
| 25 | + - target: aarch64-apple-darwin |
| 26 | + os: macos-latest |
| 27 | + - target: x86_64-unknown-linux-gnu |
| 28 | + os: ubuntu-latest |
| 29 | + - target: aarch64-unknown-linux-gnu |
| 30 | + os: ubuntu-latest |
| 31 | + |
| 32 | + steps: |
| 33 | + - name: Checkout |
| 34 | + uses: actions/checkout@v4 |
| 35 | + |
| 36 | + - name: Install Rust |
| 37 | + uses: dtolnay/rust-toolchain@stable |
| 38 | + with: |
| 39 | + targets: ${{ matrix.target }} |
| 40 | + |
| 41 | + - name: Install cross (Linux ARM) |
| 42 | + if: matrix.target == 'aarch64-unknown-linux-gnu' |
| 43 | + run: cargo install cross |
| 44 | + |
| 45 | + - name: Build (cross) |
| 46 | + if: matrix.target == 'aarch64-unknown-linux-gnu' |
| 47 | + run: cross build --release --target ${{ matrix.target }} |
| 48 | + |
| 49 | + - name: Build (native) |
| 50 | + if: matrix.target != 'aarch64-unknown-linux-gnu' |
| 51 | + run: cargo build --release --target ${{ matrix.target }} |
| 52 | + |
| 53 | + - name: Package |
| 54 | + shell: bash |
| 55 | + run: | |
| 56 | + cd target/${{ matrix.target }}/release |
| 57 | + tar -czvf ../../../weasel-${{ matrix.target }}.tar.gz weasel |
| 58 | + cd ../../.. |
| 59 | +
|
| 60 | + - name: Upload artifact |
| 61 | + uses: actions/upload-artifact@v4 |
| 62 | + with: |
| 63 | + name: weasel-${{ matrix.target }} |
| 64 | + path: weasel-${{ matrix.target }}.tar.gz |
| 65 | + |
| 66 | + release: |
| 67 | + name: Create Nightly Release |
| 68 | + needs: build |
| 69 | + runs-on: ubuntu-latest |
| 70 | + permissions: |
| 71 | + contents: write |
| 72 | + |
| 73 | + steps: |
| 74 | + - name: Checkout |
| 75 | + uses: actions/checkout@v4 |
| 76 | + |
| 77 | + - name: Get version and date |
| 78 | + id: version |
| 79 | + run: | |
| 80 | + DATE=$(date +%Y%m%d) |
| 81 | + SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7) |
| 82 | + echo "tag=nightly-${DATE}-${SHORT_SHA}" >> $GITHUB_OUTPUT |
| 83 | + echo "name=Nightly ${DATE}" >> $GITHUB_OUTPUT |
| 84 | +
|
| 85 | + - name: Download artifacts |
| 86 | + uses: actions/download-artifact@v4 |
| 87 | + with: |
| 88 | + path: artifacts |
| 89 | + |
| 90 | + - name: Delete existing nightly tag |
| 91 | + continue-on-error: true |
| 92 | + run: | |
| 93 | + git push origin :refs/tags/${{ steps.version.outputs.tag }} || true |
| 94 | +
|
| 95 | + - name: Create Release |
| 96 | + uses: softprops/action-gh-release@v2 |
| 97 | + with: |
| 98 | + tag_name: ${{ steps.version.outputs.tag }} |
| 99 | + name: ${{ steps.version.outputs.name }} |
| 100 | + files: artifacts/**/*.tar.gz |
| 101 | + prerelease: true |
| 102 | + body: | |
| 103 | + ## Nightly Build |
| 104 | +
|
| 105 | + This is an automated nightly build from the `main` branch. |
| 106 | +
|
| 107 | + **Commit:** ${{ github.sha }} |
| 108 | + **Date:** ${{ steps.version.outputs.tag }} |
| 109 | +
|
| 110 | + > ⚠️ This is a pre-release build and may be unstable. |
| 111 | +
|
| 112 | + ### Installation |
| 113 | +
|
| 114 | + ```bash |
| 115 | + # Using weaselup (will install latest stable) |
| 116 | + curl -sSL https://raw.githubusercontent.com/slvDev/weasel/main/weaselup/install | bash |
| 117 | +
|
| 118 | + # Or download this nightly directly |
| 119 | + # macOS (Apple Silicon) |
| 120 | + curl -sSL https://github.com/slvDev/weasel/releases/download/${{ steps.version.outputs.tag }}/weasel-aarch64-apple-darwin.tar.gz | tar xz |
| 121 | +
|
| 122 | + # macOS (Intel) |
| 123 | + curl -sSL https://github.com/slvDev/weasel/releases/download/${{ steps.version.outputs.tag }}/weasel-x86_64-apple-darwin.tar.gz | tar xz |
| 124 | +
|
| 125 | + # Linux (x86_64) |
| 126 | + curl -sSL https://github.com/slvDev/weasel/releases/download/${{ steps.version.outputs.tag }}/weasel-x86_64-unknown-linux-gnu.tar.gz | tar xz |
| 127 | + ``` |
0 commit comments