|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v[0-9]+.[0-9]+.[0-9]+" |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + tag: |
| 10 | + description: Existing release tag (for example v1.0.0) |
| 11 | + required: true |
| 12 | + type: string |
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: read |
| 16 | + |
| 17 | +concurrency: |
| 18 | + group: release-${{ inputs.tag || github.ref_name }} |
| 19 | + cancel-in-progress: false |
| 20 | + |
| 21 | +jobs: |
| 22 | + build: |
| 23 | + name: Build ${{ matrix.platform }} ${{ matrix.arch }} |
| 24 | + runs-on: ${{ matrix.runner }} |
| 25 | + strategy: |
| 26 | + fail-fast: false |
| 27 | + matrix: |
| 28 | + include: |
| 29 | + - platform: Linux |
| 30 | + arch: x86_64 |
| 31 | + runner: ubuntu-24.04 |
| 32 | + rust_host: x86_64-unknown-linux-gnu |
| 33 | + artifact: dexdec-linux-x86_64 |
| 34 | + bundles: deb,appimage |
| 35 | + - platform: Windows |
| 36 | + arch: x86_64 |
| 37 | + runner: windows-2025 |
| 38 | + rust_host: x86_64-pc-windows-msvc |
| 39 | + artifact: dexdec-windows-x86_64 |
| 40 | + bundles: nsis |
| 41 | + - platform: macOS |
| 42 | + arch: arm64 |
| 43 | + runner: macos-latest |
| 44 | + rust_host: aarch64-apple-darwin |
| 45 | + artifact: dexdec-macos-arm64 |
| 46 | + bundles: dmg |
| 47 | + |
| 48 | + defaults: |
| 49 | + run: |
| 50 | + shell: bash |
| 51 | + |
| 52 | + steps: |
| 53 | + - name: Check out release tag |
| 54 | + uses: actions/checkout@v7 |
| 55 | + with: |
| 56 | + ref: ${{ inputs.tag || github.ref_name }} |
| 57 | + fetch-depth: 0 |
| 58 | + |
| 59 | + - name: Set up Node.js |
| 60 | + uses: actions/setup-node@v7 |
| 61 | + with: |
| 62 | + node-version: 22 |
| 63 | + cache: npm |
| 64 | + cache-dependency-path: dexdec-gui/package-lock.json |
| 65 | + |
| 66 | + - name: Set up Rust |
| 67 | + run: | |
| 68 | + rustup toolchain install stable --profile minimal |
| 69 | + rustup default stable |
| 70 | +
|
| 71 | + - name: Verify native runner architecture |
| 72 | + run: | |
| 73 | + host="$(rustc -vV | sed -n 's/^host: //p')" |
| 74 | + echo "Rust host: $host" |
| 75 | + test "$host" = "${{ matrix.rust_host }}" |
| 76 | +
|
| 77 | + - name: Install Linux dependencies |
| 78 | + if: runner.os == 'Linux' |
| 79 | + run: | |
| 80 | + sudo apt-get update |
| 81 | + sudo apt-get install -y \ |
| 82 | + build-essential \ |
| 83 | + file \ |
| 84 | + libayatana-appindicator3-dev \ |
| 85 | + librsvg2-dev \ |
| 86 | + libssl-dev \ |
| 87 | + libwebkit2gtk-4.1-dev \ |
| 88 | + libxdo-dev \ |
| 89 | + patchelf |
| 90 | +
|
| 91 | + - name: Verify release version |
| 92 | + id: version |
| 93 | + env: |
| 94 | + RELEASE_TAG: ${{ inputs.tag || github.ref_name }} |
| 95 | + run: | |
| 96 | + version="$(node scripts/version.mjs sync --release "$RELEASE_TAG")" |
| 97 | + echo "version=$version" >> "$GITHUB_OUTPUT" |
| 98 | + echo "### DexDec $version" >> "$GITHUB_STEP_SUMMARY" |
| 99 | + cargo metadata --no-deps --format-version 1 >/dev/null |
| 100 | + node --test scripts/version.test.mjs |
| 101 | + node scripts/version.mjs check |
| 102 | +
|
| 103 | + - name: Install frontend dependencies |
| 104 | + working-directory: dexdec-gui |
| 105 | + run: npm ci |
| 106 | + |
| 107 | + - name: Build desktop application |
| 108 | + working-directory: dexdec-gui |
| 109 | + run: npm run tauri -- build --bundles "${{ matrix.bundles }}" |
| 110 | + |
| 111 | + - name: Build command-line tools |
| 112 | + run: cargo build --release -p dexdec -p dexdec-mcp |
| 113 | + |
| 114 | + - name: Assemble Linux assets |
| 115 | + if: runner.os == 'Linux' |
| 116 | + env: |
| 117 | + VERSION: ${{ steps.version.outputs.version }} |
| 118 | + run: | |
| 119 | + mkdir -p dist |
| 120 | + cp target/release/bundle/deb/*.deb dist/ |
| 121 | + cp target/release/bundle/appimage/*.AppImage dist/ |
| 122 | + bundle="DexDec-${VERSION}-cli-linux-x86_64" |
| 123 | + mkdir -p "dist/${bundle}" |
| 124 | + install -m 755 target/release/dexdec target/release/dexdec-mcp "dist/${bundle}/" |
| 125 | + install -m 644 LICENSE README.md "dist/${bundle}/" |
| 126 | + tar -C dist -czf "dist/${bundle}.tar.gz" "${bundle}" |
| 127 | + rm -rf "dist/${bundle}" |
| 128 | +
|
| 129 | + - name: Assemble macOS assets |
| 130 | + if: runner.os == 'macOS' |
| 131 | + env: |
| 132 | + VERSION: ${{ steps.version.outputs.version }} |
| 133 | + run: | |
| 134 | + mkdir -p dist |
| 135 | + cp target/release/bundle/dmg/*.dmg dist/ |
| 136 | + bundle="DexDec-${VERSION}-cli-macos-arm64" |
| 137 | + mkdir -p "dist/${bundle}" |
| 138 | + install -m 755 target/release/dexdec target/release/dexdec-mcp "dist/${bundle}/" |
| 139 | + install -m 644 LICENSE README.md "dist/${bundle}/" |
| 140 | + tar -C dist -czf "dist/${bundle}.tar.gz" "${bundle}" |
| 141 | + rm -rf "dist/${bundle}" |
| 142 | +
|
| 143 | + - name: Assemble Windows assets |
| 144 | + if: runner.os == 'Windows' |
| 145 | + shell: pwsh |
| 146 | + env: |
| 147 | + VERSION: ${{ steps.version.outputs.version }} |
| 148 | + run: | |
| 149 | + New-Item -ItemType Directory -Force -Path dist | Out-Null |
| 150 | + Copy-Item target/release/bundle/nsis/*.exe dist/ |
| 151 | + $bundle = "DexDec-$env:VERSION-cli-windows-x86_64" |
| 152 | + New-Item -ItemType Directory -Force -Path "dist/$bundle" | Out-Null |
| 153 | + Copy-Item target/release/dexdec.exe "dist/$bundle/" |
| 154 | + Copy-Item target/release/dexdec-mcp.exe "dist/$bundle/" |
| 155 | + Copy-Item LICENSE, README.md "dist/$bundle/" |
| 156 | + Compress-Archive -Path "dist/$bundle" -DestinationPath "dist/$bundle.zip" |
| 157 | + Remove-Item -Recurse -Force "dist/$bundle" |
| 158 | +
|
| 159 | + - name: Upload platform assets |
| 160 | + uses: actions/upload-artifact@v7 |
| 161 | + with: |
| 162 | + name: ${{ matrix.artifact }} |
| 163 | + path: dist/* |
| 164 | + if-no-files-found: error |
| 165 | + retention-days: 7 |
| 166 | + |
| 167 | + publish: |
| 168 | + name: Publish GitHub Release |
| 169 | + needs: build |
| 170 | + runs-on: ubuntu-latest |
| 171 | + permissions: |
| 172 | + contents: write |
| 173 | + steps: |
| 174 | + - name: Check out release tag |
| 175 | + uses: actions/checkout@v7 |
| 176 | + with: |
| 177 | + ref: ${{ inputs.tag || github.ref_name }} |
| 178 | + fetch-depth: 0 |
| 179 | + |
| 180 | + - name: Download platform assets |
| 181 | + uses: actions/download-artifact@v8 |
| 182 | + with: |
| 183 | + path: dist |
| 184 | + merge-multiple: true |
| 185 | + |
| 186 | + - name: Generate checksums |
| 187 | + working-directory: dist |
| 188 | + run: | |
| 189 | + find . -maxdepth 1 -type f ! -name SHA256SUMS -print0 \ |
| 190 | + | sort -z \ |
| 191 | + | xargs -0 sha256sum > SHA256SUMS |
| 192 | +
|
| 193 | + - name: Create GitHub Release |
| 194 | + env: |
| 195 | + GH_TOKEN: ${{ github.token }} |
| 196 | + RELEASE_TAG: ${{ inputs.tag || github.ref_name }} |
| 197 | + run: | |
| 198 | + if gh release view "$RELEASE_TAG" >/dev/null 2>&1; then |
| 199 | + gh release upload "$RELEASE_TAG" dist/* --clobber |
| 200 | + else |
| 201 | + gh release create "$RELEASE_TAG" dist/* \ |
| 202 | + --verify-tag \ |
| 203 | + --title "DexDec ${RELEASE_TAG#v}" \ |
| 204 | + --generate-notes |
| 205 | + fi |
0 commit comments