CI: Release Testing #19
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 Build | |
| on: | |
| push: | |
| branches: ["**"] # 每次分支推送都触发 | |
| tags: ["*"] # 包括 tag 推送 | |
| pull_request: | |
| branches: ["**"] # 每次 PR 都触发 | |
| jobs: | |
| populate-darwin-sysroot: | |
| runs-on: macos-latest | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v5 | |
| - name: Populate Darwin sysroot | |
| run: bash .github/workflows/populate_darwin_sysroot.sh | |
| - name: Create Darwin sysroot tarball | |
| run: tar -czvf .sysroot/darwin.tar.gz -C .sysroot darwin | |
| - name: Upload Darwin sysroot tarball | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: darwin-sysroot-tarball | |
| path: .sysroot/darwin.tar.gz | |
| compression-level: 0 | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: populate-darwin-sysroot | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: 1.24.x | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| image: tonistiigi/binfmt:qemu-v7.0.0-28 | |
| - name: Download Darwin sysroot tarball | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: darwin-sysroot-tarball | |
| path: .sysroot | |
| - name: Populate Darwin sysroot | |
| run: tar -xzvf .sysroot/darwin.tar.gz -C .sysroot | |
| - name: Populate Linux sysroot | |
| run: bash .github/workflows/populate_linux_sysroot.sh | |
| - name: Run GoReleaser (Build & Test) | |
| env: | |
| GITHUB_TOKEN: ${{github.token}} | |
| run: | | |
| docker run \ | |
| --rm \ | |
| -e GITHUB_TOKEN=${GITHUB_TOKEN} \ | |
| -v /var/run/docker.sock:/var/run/docker.sock \ | |
| -v $(pwd):/go/src/llgo \ | |
| -w /go/src/llgo \ | |
| ghcr.io/goreleaser/goreleaser-cross:v1.22 \ | |
| release --skip=publish,nfpm,snapcraft --clean | |
| - name: Upload Build Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: llgo-build-artifacts | |
| path: dist | |
| retention-days: 7 | |
| - name: Run GoReleaser (Release) | |
| if: startsWith(github.ref, 'refs/tags/') | |
| env: | |
| GITHUB_TOKEN: ${{github.token}} | |
| run: | | |
| echo "Publishing release for tag: ${{ github.ref }}" | |
| docker run \ | |
| --rm \ | |
| -e GITHUB_TOKEN=${GITHUB_TOKEN} \ | |
| -v /var/run/docker.sock:/var/run/docker.sock \ | |
| -v $(pwd):/go/src/llgo \ | |
| -w /go/src/llgo \ | |
| ghcr.io/goreleaser/goreleaser-cross:v1.22 \ | |
| release --clean --skip nfpm,snapcraft |