|
| 1 | +name: release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - v*.*.* |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + name: ${{ matrix.job.name }} |
| 11 | + runs-on: ${{ matrix.job.os }} |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + job: |
| 15 | + - name: macOS-x86_64 |
| 16 | + os: macos-26 |
| 17 | + target: x86_64-apple-darwin |
| 18 | + bundle: release/darwin/x86_64 |
| 19 | + arch: x64 |
| 20 | + |
| 21 | + - name: macOS-aarch64 |
| 22 | + os: macos-26 |
| 23 | + target: aarch64-apple-darwin |
| 24 | + bundle: release/darwin/aarch64 |
| 25 | + arch: aarch64 |
| 26 | + |
| 27 | + - name: Windows-x86_64 |
| 28 | + os: windows-2022 |
| 29 | + target: x86_64-pc-windows-msvc |
| 30 | + bundle: release/windows/x86_64 |
| 31 | + arch: x64 |
| 32 | + |
| 33 | + - name: Windows-aarch64 |
| 34 | + os: windows-11-arm |
| 35 | + target: aarch64-pc-windows-msvc |
| 36 | + bundle: release/windows/aarch64 |
| 37 | + arch: arm64 |
| 38 | + |
| 39 | + - name: Linux-x86_64 |
| 40 | + os: ubuntu-22.04 |
| 41 | + target: x86_64-unknown-linux-gnu |
| 42 | + bundle: release/linux/x86_64 |
| 43 | + arch: amd64 |
| 44 | + |
| 45 | + - name: Linux-aarch64 |
| 46 | + os: ubuntu-22.04-arm |
| 47 | + target: aarch64-unknown-linux-gnu |
| 48 | + bundle: release/linux/aarch64 |
| 49 | + arch: aarch64 |
| 50 | + |
| 51 | + steps: |
| 52 | + - name: Checkout repository |
| 53 | + uses: actions/checkout@v6 |
| 54 | + |
| 55 | + # TODO: Cache cargo, pnpm |
| 56 | + # Because each release uses a new tag, the cache can’t be hit. |
| 57 | + # https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching#restrictions-for-accessing-a-cache |
| 58 | + |
| 59 | + - name: Setup Node |
| 60 | + uses: actions/setup-node@v6 |
| 61 | + with: |
| 62 | + node-version-file: package.json |
| 63 | + |
| 64 | + - name: Setup pnpm |
| 65 | + uses: pnpm/action-setup@v5 |
| 66 | + with: |
| 67 | + run_install: true |
| 68 | + |
| 69 | + - name: Setup Rust |
| 70 | + uses: dtolnay/rust-toolchain@stable |
| 71 | + with: |
| 72 | + toolchain: stable |
| 73 | + targets: ${{ matrix.job.target }} |
| 74 | + |
| 75 | + - name: Install Linux dependencies |
| 76 | + if: runner.os == 'Linux' |
| 77 | + run: | |
| 78 | + sudo apt update |
| 79 | + sudo apt install libwebkit2gtk-4.1-dev build-essential curl wget file libxdo-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev xdg-utils -y |
| 80 | + sudo apt install libclang-dev libkrb5-dev -y |
| 81 | +
|
| 82 | + - name: Get App version |
| 83 | + shell: bash |
| 84 | + run: | |
| 85 | + echo "APP_VERSION=$(node -p "require('./tauri.conf.json').version")" >> $GITHUB_ENV |
| 86 | +
|
| 87 | + - name: Build App |
| 88 | + env: |
| 89 | + TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} |
| 90 | + TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} |
| 91 | + APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }} |
| 92 | + APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} |
| 93 | + APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }} |
| 94 | + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} |
| 95 | + APPLE_ID: ${{ secrets.APPLE_ID }} |
| 96 | + APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} |
| 97 | + run: | |
| 98 | + pnpm build --target ${{ matrix.job.target }} |
| 99 | +
|
| 100 | + - name: Organize App files (macOS) |
| 101 | + if: runner.os == 'macOS' |
| 102 | + run: | |
| 103 | + mkdir -p ${{ matrix.job.bundle }} |
| 104 | + mv target/${{ matrix.job.target }}/release/bundle/dmg/Dataflare_${{ env.APP_VERSION }}_${{ matrix.job.arch }}.dmg ${{ matrix.job.bundle }}/Dataflare.dmg |
| 105 | + mv target/${{ matrix.job.target }}/release/bundle/macos/Dataflare.app.tar.gz ${{ matrix.job.bundle }} |
| 106 | + echo '{"version":"${{ env.APP_VERSION }}","url":"https://assets.dataflare.app/${{ matrix.job.bundle }}/Dataflare.app.tar.gz","signature":"'$(cat target/${{ matrix.job.target }}/release/bundle/macos/Dataflare.app.tar.gz.sig)'"}' > ${{ matrix.job.bundle }}/latest.json |
| 107 | + cp ${{ matrix.job.bundle }}/Dataflare.dmg ${{ matrix.job.bundle }}/Dataflare-${{ env.APP_VERSION }}.dmg |
| 108 | +
|
| 109 | + - name: Organize App files (Linux) |
| 110 | + if: runner.os == 'Linux' |
| 111 | + run: | |
| 112 | + mkdir -p ${{ matrix.job.bundle }} |
| 113 | + mv target/${{ matrix.job.target }}/release/bundle/appimage/Dataflare_${{ env.APP_VERSION }}_${{ matrix.job.arch }}.AppImage ${{ matrix.job.bundle }}/Dataflare.AppImage |
| 114 | + mv target/${{ matrix.job.target }}/release/bundle/appimage/Dataflare_${{ env.APP_VERSION }}_${{ matrix.job.arch }}.AppImage.tar.gz ${{ matrix.job.bundle }}/Dataflare.AppImage.tar.gz |
| 115 | + echo '{"version":"${{ env.APP_VERSION }}","url":"https://assets.dataflare.app/${{ matrix.job.bundle }}/Dataflare.AppImage.tar.gz","signature":"'$(cat target/${{ matrix.job.target }}/release/bundle/appimage/Dataflare_${{ env.APP_VERSION }}_${{ matrix.job.arch }}.AppImage.tar.gz.sig)'"}' > ${{ matrix.job.bundle }}/latest.json |
| 116 | + cp ${{ matrix.job.bundle }}/Dataflare.AppImage ${{ matrix.job.bundle }}/Dataflare-${{ env.APP_VERSION }}.AppImage |
| 117 | +
|
| 118 | + - name: Organize App files (Windows) |
| 119 | + if: runner.os == 'Windows' |
| 120 | + shell: bash |
| 121 | + run: | |
| 122 | + mkdir -p ${{ matrix.job.bundle }} |
| 123 | + mv target/${{ matrix.job.target }}/release/bundle/nsis/Dataflare_${{ env.APP_VERSION }}_${{ matrix.job.arch }}-setup.exe ${{ matrix.job.bundle }}/Dataflare-Setup.exe |
| 124 | + mv target/${{ matrix.job.target }}/release/bundle/nsis/Dataflare_${{ env.APP_VERSION }}_${{ matrix.job.arch }}-setup.nsis.zip ${{ matrix.job.bundle }}/Dataflare.zip |
| 125 | + echo '{"version":"${{ env.APP_VERSION }}","url":"https://assets.dataflare.app/${{ matrix.job.bundle }}/Dataflare.zip","signature":"'$(cat target/${{ matrix.job.target }}/release/bundle/nsis/Dataflare_${{ env.APP_VERSION }}_${{ matrix.job.arch }}-setup.nsis.zip.sig)'"}' > ${{ matrix.job.bundle }}/latest.json |
| 126 | + cp ${{ matrix.job.bundle }}/Dataflare-Setup.exe ${{ matrix.job.bundle }}/Dataflare-Setup-${{ env.APP_VERSION }}.exe |
| 127 | +
|
| 128 | + - name: Upload to R2 |
| 129 | + uses: wyhaya/upload-cloudflare-r2@9ac9d847e87f5674ed5f14c11a2f0f44d8a5c368 |
| 130 | + with: |
| 131 | + account_id: ${{ secrets.R2_ACCOUNT_ID }} |
| 132 | + access_key_id: ${{ secrets.R2_ACCESS_KEY_ID }} |
| 133 | + secret_access_key: ${{ secrets.R2_SECRET_ACCESS_KEY }} |
| 134 | + bucket: ${{ secrets.R2_BUCKET }} |
| 135 | + source_directory: ${{ matrix.job.bundle }} |
| 136 | + destination_directory: ${{ matrix.job.bundle }} |
| 137 | + cache_control: | |
| 138 | + .* public, max-age=0, must-revalidate |
| 139 | +
|
| 140 | + # Match any file with a version number |
| 141 | + (\d+\.)+\w+$ public, max-age=2678400, immutable |
0 commit comments