|
| 1 | +name: "Tauri Release" |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [created] |
| 6 | + |
| 7 | +jobs: |
| 8 | + publish-tauri: |
| 9 | + strategy: |
| 10 | + fail-fast: false |
| 11 | + matrix: |
| 12 | + platform: [macos-latest, ubuntu-20.04, windows-latest] |
| 13 | + include: |
| 14 | + - platform: macos-latest |
| 15 | + target: darwin-universal |
| 16 | + bundle_ext: dmg |
| 17 | + artifact_name: macOS |
| 18 | + - platform: ubuntu-20.04 |
| 19 | + target: linux-x86_64 |
| 20 | + bundle_ext: AppImage |
| 21 | + artifact_name: AppImage |
| 22 | + - platform: ubuntu-20.04 |
| 23 | + target: linux-x86_64 |
| 24 | + bundle_ext: deb |
| 25 | + artifact_name: Debian |
| 26 | + - platform: ubuntu-20.04 |
| 27 | + target: linux-x86_64 |
| 28 | + bundle_ext: rpm |
| 29 | + artifact_name: RPM |
| 30 | + - platform: windows-latest |
| 31 | + target: windows-x86_64 |
| 32 | + bundle_ext: msi |
| 33 | + artifact_name: Windows-MSI |
| 34 | + - platform: windows-latest |
| 35 | + target: windows-x86_64 |
| 36 | + bundle_ext: exe |
| 37 | + artifact_name: Windows-EXE |
| 38 | + |
| 39 | + runs-on: ${{ matrix.platform }} |
| 40 | + steps: |
| 41 | + - name: Checkout repository |
| 42 | + uses: actions/checkout@v3 |
| 43 | + |
| 44 | + - name: Setup Node.js |
| 45 | + uses: actions/setup-node@v3 |
| 46 | + with: |
| 47 | + node-version: 22 |
| 48 | + cache: 'pnpm' |
| 49 | + |
| 50 | + - name: Install pnpm |
| 51 | + uses: pnpm/action-setup@v2 |
| 52 | + with: |
| 53 | + version: 8 |
| 54 | + run_install: false |
| 55 | + |
| 56 | + - name: Install Rust stable |
| 57 | + uses: dtolnay/rust-toolchain@stable |
| 58 | + with: |
| 59 | + targets: ${{ matrix.target }} |
| 60 | + |
| 61 | + # Install Linux dependencies |
| 62 | + - name: Install Linux dependencies |
| 63 | + if: matrix.platform == 'ubuntu-20.04' |
| 64 | + run: | |
| 65 | + sudo apt-get update |
| 66 | + sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential curl wget file libxdo-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev |
| 67 | +
|
| 68 | + # Install macOS dependencies |
| 69 | + - name: Install macOS dependencies |
| 70 | + if: matrix.platform == 'macos-latest' |
| 71 | + run: | |
| 72 | + rustup target add aarch64-apple-darwin |
| 73 | +
|
| 74 | + # Install Windows dependencies |
| 75 | + - name: Install Windows dependencies |
| 76 | + if: matrix.platform == 'windows-latest' |
| 77 | + run: | |
| 78 | + # No additional dependencies needed for Windows |
| 79 | +
|
| 80 | + - name: Install dependencies |
| 81 | + run: pnpm install |
| 82 | + |
| 83 | + # Build the app for the specific target |
| 84 | + - name: Build Tauri app |
| 85 | + uses: tauri-apps/tauri-action@v0 |
| 86 | + env: |
| 87 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 88 | + TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} |
| 89 | + TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} |
| 90 | + with: |
| 91 | + tagName: ${{ github.ref_name }} |
| 92 | + releaseName: "Gitea Mirror v__VERSION__" |
| 93 | + releaseBody: "See the assets to download this version and install." |
| 94 | + releaseDraft: false |
| 95 | + prerelease: false |
| 96 | + args: --target ${{ matrix.target }} |
| 97 | + |
| 98 | + # Upload the specific bundle to the GitHub release |
| 99 | + - name: Upload Release Asset |
| 100 | + uses: actions/upload-release-asset@v1 |
| 101 | + env: |
| 102 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 103 | + with: |
| 104 | + upload_url: ${{ github.event.release.upload_url }} |
| 105 | + asset_path: ./src-tauri/target/release/bundle/${{ matrix.bundle_ext }}/Gitea*.${{ matrix.bundle_ext }} |
| 106 | + asset_name: gitea-mirror-${{ github.ref_name }}-${{ matrix.artifact_name }}.${{ matrix.bundle_ext }} |
| 107 | + asset_content_type: application/octet-stream |
| 108 | + |
| 109 | + # Generate update manifest and update the release |
| 110 | + update-release: |
| 111 | + needs: publish-tauri |
| 112 | + runs-on: ubuntu-latest |
| 113 | + steps: |
| 114 | + - name: Checkout repository |
| 115 | + uses: actions/checkout@v3 |
| 116 | + |
| 117 | + - name: Setup Node.js |
| 118 | + uses: actions/setup-node@v3 |
| 119 | + with: |
| 120 | + node-version: 22 |
| 121 | + cache: 'pnpm' |
| 122 | + |
| 123 | + - name: Install pnpm |
| 124 | + uses: pnpm/action-setup@v2 |
| 125 | + with: |
| 126 | + version: 8 |
| 127 | + run_install: false |
| 128 | + |
| 129 | + - name: Download all artifacts |
| 130 | + uses: actions/download-artifact@v3 |
| 131 | + with: |
| 132 | + path: artifacts |
| 133 | + |
| 134 | + - name: Generate update manifest |
| 135 | + run: | |
| 136 | + # Extract version from tag (remove 'v' prefix if present) |
| 137 | + VERSION="${{ github.ref_name }}" |
| 138 | + VERSION="${VERSION#v}" |
| 139 | +
|
| 140 | + # Create directory structure |
| 141 | + mkdir -p src-tauri/target/release/bundle |
| 142 | +
|
| 143 | + # Move artifacts to the expected locations |
| 144 | + find artifacts -type f -name "*.deb" -exec cp {} src-tauri/target/release/bundle/ \; |
| 145 | + find artifacts -type f -name "*.rpm" -exec cp {} src-tauri/target/release/bundle/ \; |
| 146 | + find artifacts -type f -name "*.AppImage" -exec cp {} src-tauri/target/release/bundle/ \; |
| 147 | + find artifacts -type f -name "*.msi" -exec cp {} src-tauri/target/release/bundle/ \; |
| 148 | + find artifacts -type f -name "*.exe" -exec cp {} src-tauri/target/release/bundle/ \; |
| 149 | + find artifacts -type f -name "*.dmg" -exec cp {} src-tauri/target/release/bundle/ \; |
| 150 | +
|
| 151 | + # Generate the update manifest |
| 152 | + node scripts/generate-update-manifest.js "$VERSION" "Release $VERSION" |
| 153 | +
|
| 154 | + # Sign the update manifest if keys are available |
| 155 | + if [ -n "${{ secrets.TAURI_PRIVATE_KEY }}" ] && [ -n "${{ secrets.TAURI_KEY_PASSWORD }}" ]; then |
| 156 | + echo "${{ secrets.TAURI_PRIVATE_KEY }}" > tauri.key.pem |
| 157 | + pnpm tauri signer sign --password "${{ secrets.TAURI_KEY_PASSWORD }}" update.json |
| 158 | + rm tauri.key.pem |
| 159 | + fi |
| 160 | +
|
| 161 | + - name: Upload update manifest |
| 162 | + uses: actions/upload-release-asset@v1 |
| 163 | + env: |
| 164 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 165 | + with: |
| 166 | + upload_url: ${{ github.event.release.upload_url }} |
| 167 | + asset_path: ./update.json |
| 168 | + asset_name: update.json |
| 169 | + asset_content_type: application/json |
| 170 | + |
| 171 | + - name: Update Release |
| 172 | + uses: softprops/action-gh-release@v1 |
| 173 | + with: |
| 174 | + tag_name: ${{ github.ref_name }} |
| 175 | + name: "Gitea Mirror v${{ github.ref_name }}" |
| 176 | + body: | |
| 177 | + ## Gitea Mirror v${{ github.ref_name }} |
| 178 | +
|
| 179 | + ### Installation |
| 180 | +
|
| 181 | + Download the appropriate package for your operating system: |
| 182 | +
|
| 183 | + - **Windows**: `.exe` or `.msi` file |
| 184 | + - **macOS**: `.dmg` file |
| 185 | + - **Linux**: `.AppImage`, `.deb`, or `.rpm` file |
| 186 | +
|
| 187 | + ### Automatic Updates |
| 188 | +
|
| 189 | + This release supports automatic updates. Your application will notify you when a new version is available. |
| 190 | +
|
| 191 | + ### Changes in this release |
| 192 | +
|
| 193 | + ${{ github.event.release.body }} |
| 194 | + draft: false |
| 195 | + prerelease: false |
| 196 | + env: |
| 197 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments