|
| 1 | +name: golden |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [main] |
| 5 | + tags: |
| 6 | + - "v[0-9]+.[0-9]+.[0-9]+*" |
| 7 | + paths-ignore: |
| 8 | + - "**/README.md" |
| 9 | + merge_group: |
| 10 | + pull_request: |
| 11 | + paths-ignore: |
| 12 | + - "**/README.md" |
| 13 | +env: |
| 14 | + # Make sure to exit early if cache segment download times out after 2 minutes. |
| 15 | + # We limit cache download as a whole to 5 minutes. |
| 16 | + SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2 |
| 17 | + |
| 18 | +# Do not cancel this workflow on main. See https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/16616 |
| 19 | +concurrency: |
| 20 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 21 | + cancel-in-progress: true |
| 22 | + |
| 23 | +permissions: read-all |
| 24 | + |
| 25 | +jobs: |
| 26 | + build-dev: |
| 27 | + runs-on: ubuntu-24.04 |
| 28 | + if: ${{ github.actor != 'dependabot[bot]' }} |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 |
| 31 | + - uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5 |
| 32 | + with: |
| 33 | + go-version: 1.23.10 |
| 34 | + cache: false |
| 35 | + - name: Cache Go |
| 36 | + id: go-cache |
| 37 | + timeout-minutes: 5 |
| 38 | + uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4 |
| 39 | + with: |
| 40 | + path: | |
| 41 | + ~/go/bin |
| 42 | + ~/go/pkg/mod |
| 43 | + key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }} |
| 44 | + - name: Set up QEMU |
| 45 | + uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3 |
| 46 | + - name: Set up Docker Buildx |
| 47 | + uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3 |
| 48 | + - name: Build binaries |
| 49 | + run: | |
| 50 | + GOOS=linux GOARCH=ppc64le make golden |
| 51 | + GOOS=linux GOARCH=arm64 make golden |
| 52 | + GOOS=linux GOARCH=amd64 make golden |
| 53 | + GOOS=linux GOARCH=s390x make golden |
| 54 | + cp bin/golden_* cmd/golden/ |
| 55 | + - name: Build golden |
| 56 | + uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6 |
| 57 | + with: |
| 58 | + context: cmd/golden |
| 59 | + push: false |
| 60 | + tags: ghcr.io/open-telemetry/opentelemetry-collector-contrib/golden:dev |
| 61 | + platforms: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le |
| 62 | + |
| 63 | + publish-latest: |
| 64 | + runs-on: ubuntu-24.04 |
| 65 | + if: (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) && github.repository == 'open-telemetry/opentelemetry-collector-contrib' |
| 66 | + permissions: |
| 67 | + packages: write |
| 68 | + steps: |
| 69 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 |
| 70 | + - uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5 |
| 71 | + with: |
| 72 | + go-version: 1.23.10 |
| 73 | + cache: false |
| 74 | + - name: Cache Go |
| 75 | + id: go-cache |
| 76 | + timeout-minutes: 5 |
| 77 | + uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4 |
| 78 | + with: |
| 79 | + path: | |
| 80 | + ~/go/bin |
| 81 | + ~/go/pkg/mod |
| 82 | + key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }} |
| 83 | + - name: Set up QEMU |
| 84 | + uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3 |
| 85 | + - name: Set up Docker Buildx |
| 86 | + uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3 |
| 87 | + - name: Login to GitHub Container Registry |
| 88 | + uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3 |
| 89 | + with: |
| 90 | + registry: ghcr.io |
| 91 | + username: ${{ github.repository_owner }} |
| 92 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 93 | + - name: Build binaries |
| 94 | + run: | |
| 95 | + GOOS=linux GOARCH=ppc64le make golden |
| 96 | + GOOS=linux GOARCH=arm64 make golden |
| 97 | + GOOS=linux GOARCH=amd64 make golden |
| 98 | + GOOS=linux GOARCH=s390x make golden |
| 99 | + cp bin/golden_* cmd/golden/ |
| 100 | + - name: Push golden to Github packages |
| 101 | + uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6 |
| 102 | + with: |
| 103 | + context: cmd/golden |
| 104 | + push: true |
| 105 | + tags: ghcr.io/open-telemetry/opentelemetry-collector-contrib/golden:latest |
| 106 | + platforms: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le |
| 107 | + |
| 108 | + publish-stable: |
| 109 | + runs-on: ubuntu-24.04 |
| 110 | + if: startsWith(github.ref, 'refs/tags/v') && github.repository == 'open-telemetry/opentelemetry-collector-contrib' |
| 111 | + permissions: |
| 112 | + packages: write |
| 113 | + steps: |
| 114 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 |
| 115 | + - uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5 |
| 116 | + with: |
| 117 | + go-version: 1.23.10 |
| 118 | + cache: false |
| 119 | + - name: Cache Go |
| 120 | + id: go-cache |
| 121 | + timeout-minutes: 5 |
| 122 | + uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4 |
| 123 | + with: |
| 124 | + path: | |
| 125 | + ~/go/bin |
| 126 | + ~/go/pkg/mod |
| 127 | + key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }} |
| 128 | + - name: Set up QEMU |
| 129 | + uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3 |
| 130 | + - name: Set up Docker Buildx |
| 131 | + uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3 |
| 132 | + - name: Set Release Tag |
| 133 | + id: github_tag |
| 134 | + run: ./.github/workflows/scripts/set_release_tag.sh |
| 135 | + - name: Login to GitHub Container Registry |
| 136 | + uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3 |
| 137 | + with: |
| 138 | + registry: ghcr.io |
| 139 | + username: ${{ github.repository_owner }} |
| 140 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 141 | + - name: Build binaries |
| 142 | + run: | |
| 143 | + GOOS=linux GOARCH=ppc64le make golden |
| 144 | + GOOS=linux GOARCH=arm64 make golden |
| 145 | + GOOS=linux GOARCH=amd64 make golden |
| 146 | + GOOS=linux GOARCH=s390x make golden |
| 147 | + cp bin/golden_* cmd/golden/ |
| 148 | + - name: Push golden to Github packages |
| 149 | + uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6 |
| 150 | + with: |
| 151 | + context: cmd/golden |
| 152 | + push: true |
| 153 | + tags: ghcr.io/open-telemetry/opentelemetry-collector-contrib/golden:${{ steps.github_tag.outputs.tag }} |
| 154 | + platforms: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le |
0 commit comments