v2.5.0 CLI Build #37
Workflow file for this run
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: Build CLI Binaries | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Release version (e.g., v1.0.0)' | |
| required: true | |
| type: string | |
| create_release: | |
| description: 'Create a GitHub release' | |
| required: false | |
| type: boolean | |
| default: true | |
| jobs: | |
| build-cli: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - goos: darwin | |
| goarch: amd64 | |
| suffix: darwin-amd64 | |
| - goos: darwin | |
| goarch: arm64 | |
| suffix: darwin-arm64 | |
| - goos: linux | |
| goarch: amd64 | |
| suffix: linux-amd64 | |
| - goos: linux | |
| goarch: arm64 | |
| suffix: linux-arm64 | |
| - goos: windows | |
| goarch: amd64 | |
| suffix: windows-amd64 | |
| ext: .exe | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| token: ${{ secrets.SUBMODULE_TOKEN }} | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: cli/go.mod | |
| - name: Copy resolver list for embedding | |
| run: cp app/src/main/res/raw/resolvers.txt cli/resolvers.txt | |
| - name: Build | |
| working-directory: cli | |
| env: | |
| CGO_ENABLED: '0' | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| run: | | |
| VERSION="${{ github.event.inputs.version || github.ref_name }}" | |
| LDFLAGS="-s -w -X main.version=${VERSION}" | |
| if [ -n "${{ secrets.CONFIG_ENCRYPTION_KEY }}" ]; then | |
| LDFLAGS="${LDFLAGS} -X main.configKey=${{ secrets.CONFIG_ENCRYPTION_KEY }}" | |
| fi | |
| go build -trimpath -ldflags="${LDFLAGS}" -o ../slipnet-${{ matrix.suffix }}${{ matrix.ext }} . | |
| - name: Compress with UPX (Linux/macOS only) | |
| if: matrix.goos != 'windows' | |
| run: | | |
| sudo apt-get install -y upx-ucl > /dev/null 2>&1 | |
| upx --best --lzma slipnet-${{ matrix.suffix }} || true | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: slipnet-${{ matrix.suffix }} | |
| path: slipnet-${{ matrix.suffix }}${{ matrix.ext }} | |
| release-cli: | |
| needs: build-cli | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && github.event.inputs.create_release == 'true') | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: slipnet-* | |
| path: ./artifacts | |
| merge-multiple: true | |
| - name: Create/Update Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.event.inputs.version || github.ref_name }} | |
| name: ${{ github.event.inputs.version || github.ref_name }} | |
| files: ./artifacts/slipnet-* | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |