Debian Codegraph @

.github/workflows/builder-snapshot.yaml

raw
1 name: Builder - Snapshot build
2 on:
3 push:
4 branches: [main]
5
6 # on PRs touching the builder
7 pull_request:
8 branches: [main]
9 paths:
10 - "cmd/builder/**"
11
12 permissions:
13 contents: read
14
15 env:
16 # renovate: datasource=github-tags depName=goreleaser-pro packageName=goreleaser/goreleaser-pro
17 GORELEASER_PRO_VERSION: v2.11.1
18
19 jobs:
20 snapshot:
21 runs-on: ubuntu-24.04
22 if: ${{ github.repository_owner == 'open-telemetry' }}
23 steps:
24 - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
25 with:
26 path: .core
27
28 - name: Pull the latest releases repo
29 uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
30 with:
31 path: opentelemetry-collector-releases
32 repository: open-telemetry/opentelemetry-collector-releases
33
34 - name: Copy release files
35 run: cp -R ./opentelemetry-collector-releases/cmd/builder/. ./.core/cmd/builder/
36
37 - uses: sigstore/cosign-installer@faadad0cce49287aee09b3a48701e75088a2c6ad # v4.0.0
38
39 - uses: anchore/sbom-action/download-syft@fbfd9c6c189226748411491745178e0c2017392d # v0.20.10
40
41 - uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
42 with:
43 platforms: amd64, arm64,ppc64le
44
45 - uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
46
47 - name: Setup Go
48 uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
49 with:
50 go-version: stable
51 cache: false
52
53 - name: Cache Go
54 id: go-cache
55 uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
56 with:
57 path: |
58 ~/go/bin
59 ~/go/pkg/mod
60 key: go-cache-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/go.sum') }}
61
62 - name: Check GoReleaser
63 uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
64 with:
65 distribution: goreleaser-pro
66 version: ${{ env.GORELEASER_PRO_VERSION }}
67 args: check --verbose -f .core/cmd/builder/.goreleaser.yaml
68 env:
69 GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
70 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71
72 - name: Run GoReleaser
73 uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
74 with:
75 distribution: goreleaser-pro
76 version: ${{ env.GORELEASER_PRO_VERSION }}
77 args: --snapshot --clean -f .core/cmd/builder/.goreleaser.yaml --skip sign
78 env:
79 GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
80 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81 COSIGN_YES: false
82
83 # Only create an issue if the workflows fails on push to main branch
84 - name: File an issue if the workflow failed
85 if: failure() && github.ref == 'refs/heads/main'
86 run: |
87 template=$(cat <<'END'
88 [Link to job log](%s)
89 END
90 )
91 job_url="$(gh run view ${{ github.run_id }} -R ${{ github.repository }} --json jobs -q '.jobs[] | select(.name == "snapshot") | .url')"
92 body="$(printf "$template" "$job_url")"
93 gh issue create -R ${{ github.repository }} -t 'OCB snapshot workflow failed' -b "$body" -l 'ci-cd' -l 'area:builder'
94 env:
95 GH_TOKEN: ${{ github.token }}