Release #12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Release version (e.g. 0.1.0). Leave empty to use version from tauri.conf.json" | |
| required: false | |
| default: "" | |
| permissions: | |
| contents: write | |
| jobs: | |
| # Determine the version and tag name to use for the release | |
| prepare: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| tag_name: ${{ steps.get_version.outputs.tag_name }} | |
| version: ${{ steps.get_version.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get version | |
| id: get_version | |
| run: | | |
| if [ "${{ github.event_name }}" = "push" ]; then | |
| # Triggered by tag push — use the tag directly | |
| TAG="${GITHUB_REF#refs/tags/}" | |
| VERSION="${TAG#v}" | |
| elif [ -n "${{ github.event.inputs.version }}" ]; then | |
| # Manual trigger with version specified | |
| VERSION="${{ github.event.inputs.version }}" | |
| TAG="v${VERSION}" | |
| else | |
| # Manual trigger without version — read from tauri.conf.json | |
| VERSION=$(grep -oP '"version":\s*"\K[^"]+' client/src-tauri/tauri.conf.json) | |
| TAG="v${VERSION}" | |
| fi | |
| echo "tag_name=${TAG}" >> "$GITHUB_OUTPUT" | |
| echo "version=${VERSION}" >> "$GITHUB_OUTPUT" | |
| echo "Resolved version: ${VERSION}, tag: ${TAG}" | |
| release: | |
| needs: prepare | |
| permissions: | |
| contents: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: [macos-latest, ubuntu-22.04, windows-latest] | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: setup node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: install Rust stable | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} | |
| - name: install dependencies (ubuntu only) | |
| if: matrix.platform == 'ubuntu-22.04' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf | |
| - name: install frontend dependencies | |
| run: npm install | |
| working-directory: ./client | |
| - name: setup go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "stable" | |
| - name: build dnstt | |
| run: | | |
| git clone https://www.bamsoftware.com/git/dnstt.git | |
| cd dnstt/dnstt-client | |
| go build -ldflags="-s -w" -o ../../dnstt-client${{ matrix.platform == 'windows-latest' && '.exe' || '' }} | |
| shell: bash | |
| - name: download extra tools | |
| run: | | |
| mkdir -p extra-tools | |
| # Fetch latest versions | |
| XRAY_VERSION=$(curl -s https://api.github.com/repos/XTLS/Xray-core/releases/latest | grep '"tag_name":' | head -n 1 | cut -d'"' -f4) | |
| SING_VERSION=$(curl -s https://api.github.com/repos/SagerNet/sing-box/releases/latest | grep '"tag_name":' | head -n 1 | cut -d'"' -f4 | sed 's/v//') | |
| # Platform mapping | |
| if [ "${{ matrix.platform }}" == "windows-latest" ]; then | |
| XRAY_OS="windows-64" | |
| SING_OS="windows-amd64" | |
| SING_EXT="zip" | |
| elif [ "${{ matrix.platform }}" == "ubuntu-22.04" ]; then | |
| XRAY_OS="linux-64" | |
| SING_OS="linux-amd64" | |
| SING_EXT="tar.gz" | |
| else | |
| XRAY_OS="macos-64" | |
| SING_OS="darwin-amd64" | |
| SING_EXT="tar.gz" | |
| fi | |
| # Download Xray | |
| echo "Downloading Xray $XRAY_VERSION for $XRAY_OS" | |
| curl -L "https://github.com/XTLS/Xray-core/releases/download/$XRAY_VERSION/Xray-$XRAY_OS.zip" -o xray.zip | |
| unzip xray.zip -d extra-tools/xray | |
| # Download Sing-box | |
| echo "Downloading Sing-box $SING_VERSION for $SING_OS" | |
| curl -L "https://github.com/SagerNet/sing-box/releases/download/v$SING_VERSION/sing-box-$SING_VERSION-$SING_OS.$SING_EXT" -o sing-box.$SING_EXT | |
| if [ "$SING_EXT" == "zip" ]; then | |
| unzip sing-box.$SING_EXT -d extra-tools/sing-box | |
| else | |
| tar -xzf sing-box.$SING_EXT -C extra-tools | |
| mv extra-tools/sing-box-* extra-tools/sing-box | |
| fi | |
| # Download OpenVPN (Windows only - Using Choco for a reliable binary) | |
| if [ "${{ matrix.platform }}" == "windows-latest" ]; then | |
| echo "Installing OpenVPN via Chocolatey..." | |
| choco install openvpn -y | |
| mkdir -p extra-tools/openvpn | |
| # Copy common binaries and drivers | |
| cp "/c/Program Files/OpenVPN/bin/openvpn.exe" extra-tools/openvpn/ | |
| cp "/c/Program Files/OpenVPN/bin/openssl.exe" extra-tools/openvpn/ || true | |
| fi | |
| # Cleanup | |
| rm -f xray.zip sing-box.$SING_EXT | |
| cp dnstt-client${{ matrix.platform == 'windows-latest' && '.exe' || '' }} extra-tools/ | |
| shell: bash | |
| - uses: tauri-apps/tauri-action@v0 | |
| id: tauri_build | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tagName: ${{ needs.prepare.outputs.tag_name }} | |
| releaseName: "CandyConnect VPN ${{ needs.prepare.outputs.tag_name }}" | |
| releaseBody: "See the assets to download this version and install." | |
| releaseDraft: false | |
| prerelease: false | |
| projectPath: ./client | |
| args: "--no-bundle" # Only build the binary for the zip package | |
| - name: package release zip | |
| run: | | |
| mkdir -p bundle | |
| if [ "${{ matrix.platform }}" == "windows-latest" ]; then | |
| APP_BIN="client/src-tauri/target/release/candy-connect.exe" | |
| ZIP_NAME="CandyConnect-${{ needs.prepare.outputs.tag_name }}-windows-x64.zip" | |
| elif [ "${{ matrix.platform }}" == "macos-latest" ]; then | |
| APP_BIN="client/src-tauri/target/release/candy-connect" | |
| ZIP_NAME="CandyConnect-${{ needs.prepare.outputs.tag_name }}-macos-x64.zip" | |
| else | |
| APP_BIN="client/src-tauri/target/release/candy-connect" | |
| ZIP_NAME="CandyConnect-${{ needs.prepare.outputs.tag_name }}-linux-x64.zip" | |
| fi | |
| cp "$APP_BIN" bundle/ | |
| cp -r extra-tools/* bundle/ | |
| if [ "${{ matrix.platform }}" == "windows-latest" ]; then | |
| 7z a "$ZIP_NAME" ./bundle/* | |
| else | |
| cd bundle && zip -r "../$ZIP_NAME" . && cd .. | |
| fi | |
| echo "ZIP_NAME=$ZIP_NAME" >> "$GITHUB_ENV" | |
| shell: bash | |
| - name: upload custom zip to release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ needs.prepare.outputs.tag_name }} | |
| files: ${{ env.ZIP_NAME }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |