|
| 1 | +name: Nightly Release |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: "0 0 */3 * *" |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + strategy: |
| 11 | + matrix: |
| 12 | + os: |
| 13 | + - { |
| 14 | + NAME: linux, |
| 15 | + OS: ubuntu-latest, |
| 16 | + ARCH: x86_64, |
| 17 | + PATH: target/optimized/bob, |
| 18 | + TARGET: "", |
| 19 | + } |
| 20 | + - { |
| 21 | + NAME: linux, |
| 22 | + OS: ubuntu-24.04-arm, |
| 23 | + ARCH: arm, |
| 24 | + PATH: target/optimized/bob, |
| 25 | + TARGET: "", |
| 26 | + } |
| 27 | + - { |
| 28 | + NAME: macos, |
| 29 | + OS: macos-latest, |
| 30 | + ARCH: x86_64, |
| 31 | + PATH: target/x86_64-apple-darwin/optimized/bob, |
| 32 | + TARGET: "x86_64-apple-darwin", |
| 33 | + } |
| 34 | + - { |
| 35 | + NAME: windows, |
| 36 | + OS: windows-latest, |
| 37 | + ARCH: x86_64, |
| 38 | + PATH: build, |
| 39 | + TARGET: "", |
| 40 | + } |
| 41 | + - { |
| 42 | + NAME: macos, |
| 43 | + OS: macos-latest, |
| 44 | + ARCH: arm, |
| 45 | + PATH: target/optimized/bob, |
| 46 | + TARGET: "", |
| 47 | + } |
| 48 | + runs-on: ${{matrix.os.OS}} |
| 49 | + steps: |
| 50 | + - uses: actions/checkout@v4 |
| 51 | + with: |
| 52 | + ref: dev |
| 53 | + - name: Install Rust |
| 54 | + uses: actions-rs/toolchain@v1 |
| 55 | + with: |
| 56 | + toolchain: stable |
| 57 | + profile: minimal |
| 58 | + override: true |
| 59 | + - name: Add Rust target for cross-compilation |
| 60 | + if: matrix.os.TARGET != '' |
| 61 | + run: rustup target add ${{ matrix.os.TARGET }} |
| 62 | + - uses: Swatinem/rust-cache@v1 |
| 63 | + - name: Build Bob |
| 64 | + uses: actions-rs/cargo@v1 |
| 65 | + with: |
| 66 | + command: build |
| 67 | + args: --locked --profile optimized ${{ matrix.os.TARGET != '' && format('--target {0}', matrix.os.TARGET) || '' }} |
| 68 | + - name: Install AppImage tools & cargo-appimage |
| 69 | + if: matrix.os.NAME == 'linux' |
| 70 | + run: | |
| 71 | + set -euo pipefail |
| 72 | + sudo apt update && sudo apt install -y libfuse2 |
| 73 | +
|
| 74 | + ARCH="${{ matrix.os.ARCH }}" |
| 75 | + if [ "$ARCH" = "arm" ] || [ "$ARCH" = "aarch64" ]; then |
| 76 | + URL="https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-aarch64.AppImage" |
| 77 | + else |
| 78 | + URL="https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" |
| 79 | + fi |
| 80 | +
|
| 81 | + echo "Downloading appimagetool from $URL" |
| 82 | + wget -c "$URL" -O appimagetool |
| 83 | + chmod +x appimagetool |
| 84 | +
|
| 85 | + # Move into PATH so tooling can call it |
| 86 | + sudo mv appimagetool /usr/local/bin/appimagetool |
| 87 | + echo "appimagetool installed at: $(command -v appimagetool)" |
| 88 | +
|
| 89 | + cargo install cargo-appimage --locked |
| 90 | + - name: Build AppImage with cargo-appimage |
| 91 | + if: matrix.os.NAME == 'linux' |
| 92 | + run: | |
| 93 | + # cargo-appimage reads package.metadata.appimage from Cargo.toml |
| 94 | + cargo appimage |
| 95 | +
|
| 96 | + # verify AppImage exists in the canonical location |
| 97 | + if ! ls target/appimage/*.AppImage >/dev/null 2>&1; then |
| 98 | + echo "No AppImage found under target/appimage/; listing for debugging:" |
| 99 | + ls -la target || true |
| 100 | + ls -la target/appimage || true |
| 101 | + exit 1 |
| 102 | + fi |
| 103 | +
|
| 104 | + echo "Found AppImage: $(ls target/appimage/*.AppImage | head -n1)" |
| 105 | + - name: Setup Bob build directory |
| 106 | + run: | |
| 107 | + mkdir build |
| 108 | + copy .\\bin\\vcruntime140.dll .\\build |
| 109 | + copy .\\target\\optimized\\bob.exe .\\build |
| 110 | + if: matrix.os.OS == 'windows-latest' |
| 111 | + - name: Upload Bob binary |
| 112 | + uses: actions/upload-artifact@v4 |
| 113 | + with: |
| 114 | + name: "bob-${{ matrix.os.NAME }}-${{ matrix.os.ARCH }}" |
| 115 | + path: ${{ matrix.os.PATH }} |
| 116 | + if-no-files-found: error |
| 117 | + - name: Upload Bob AppImage |
| 118 | + if: matrix.os.NAME == 'linux' |
| 119 | + uses: actions/upload-artifact@v4 |
| 120 | + with: |
| 121 | + name: "bob-${{ matrix.os.NAME }}-${{ matrix.os.ARCH }}-appimage" |
| 122 | + path: "target/appimage/*.AppImage" |
| 123 | + if-no-files-found: error |
| 124 | + retention-days: 7 |
| 125 | + |
| 126 | + nightly-release: |
| 127 | + needs: [build] |
| 128 | + runs-on: ubuntu-latest |
| 129 | + steps: |
| 130 | + - name: Checkout |
| 131 | + uses: actions/checkout@v4 |
| 132 | + with: |
| 133 | + ref: dev |
| 134 | + fetch-depth: 0 |
| 135 | + - name: Download artifacts |
| 136 | + uses: actions/download-artifact@v4 |
| 137 | + with: |
| 138 | + path: artifacts |
| 139 | + - name: Prepare Release Assets |
| 140 | + run: | |
| 141 | + cd artifacts |
| 142 | + # Zip directories (binaries) |
| 143 | + find . -mindepth 1 -maxdepth 1 -type d -print0 | while IFS= read -r -d $'\0' dir; do |
| 144 | + base=$(basename "$dir") |
| 145 | + zip -r "${base}.zip" "$dir" |
| 146 | + rm -r "$dir" # Remove original directory after zipping |
| 147 | + done |
| 148 | + # Move AppImages and zsync files out of subdirectories if they exist |
| 149 | + find . -mindepth 2 -name '*.AppImage*' -exec mv {} . \; |
| 150 | + # Clean up any remaining empty directories from AppImage artifacts |
| 151 | + find . -mindepth 1 -maxdepth 1 -type d -empty -delete |
| 152 | + echo "Prepared assets:" |
| 153 | + ls -l |
| 154 | + - name: Get Date |
| 155 | + id: get-date |
| 156 | + run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV |
| 157 | + - name: Release |
| 158 | + uses: softprops/action-gh-release@v1 |
| 159 | + with: |
| 160 | + tag_name: nightly-${{ env.DATE }} |
| 161 | + name: "Nightly Release ${{ env.DATE }}" |
| 162 | + prerelease: true |
| 163 | + generate_release_notes: true |
| 164 | + files: | |
| 165 | + ./artifacts/* |
0 commit comments