Fix CI: Use Go 1.26.5 and CGO_ENABLED=0 for cross-compilation #3
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: Release AdGuardHome | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Release version tag (e.g., v1.0.0)' | |
| required: true | |
| type: string | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build for ${{ matrix.os }}/${{ matrix.arch }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - os: linux | |
| arch: amd64 | |
| artifact_name: AdGuardHome_linux_amd64 | |
| - os: linux | |
| arch: arm64 | |
| artifact_name: AdGuardHome_linux_arm64 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.26.5' | |
| cache: true | |
| - name: Build binary | |
| run: | | |
| CGO_ENABLED=0 GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} go build -ldflags="-s -w -X github.com/AdguardTeam/AdGuardHome/internal/version.version=${{ github.ref_name }}" -o ${{ matrix.artifact_name }} . | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact_name }} | |
| path: ${{ matrix.artifact_name }} | |
| retention-days: 7 | |
| release: | |
| name: Create Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| merge-multiple: true | |
| - name: List artifacts | |
| run: ls -la artifacts/ | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: AdGuardHome ${{ github.ref_name }} | |
| body: | | |
| ## AdGuardHome ${{ github.ref_name }} | |
| Linux 平台精简构建版本,仅支持 linux/amd64 和 linux/arm64 两个目标平台。 | |
| ### 变更内容 | |
| - 精简构建平台至 linux/amd64 + linux/arm64 | |
| - 恢复并修复 dnsforward 核心包 | |
| - 修复 aghnet、client、rdns 等核心包 | |
| - 迁移到标准 Go 包结构 | |
| ### 下载 | |
| - `AdGuardHome_linux_amd64` - Linux x86_64 (Intel/AMD 64位) | |
| - `AdGuardHome_linux_arm64` - Linux ARM64 (Apple Silicon/ARM 64位) | |
| ### 验证 | |
| ```bash | |
| # 赋予执行权限 | |
| chmod +x AdGuardHome_linux_amd64 | |
| # 运行 | |
| ./AdGuardHome_linux_amd64 --version | |
| ``` | |
| files: | | |
| artifacts/AdGuardHome_linux_amd64 | |
| artifacts/AdGuardHome_linux_arm64 | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |