diff --git a/.github/workflows/ci-goreleaser.yaml b/.github/workflows/base-ci-goreleaser.yaml similarity index 66% rename from .github/workflows/ci-goreleaser.yaml rename to .github/workflows/base-ci-goreleaser.yaml index e41729a9..451b28c2 100644 --- a/.github/workflows/ci-goreleaser.yaml +++ b/.github/workflows/base-ci-goreleaser.yaml @@ -1,26 +1,19 @@ -name: Continuous Integration - GoReleaser +name: Reusable GoReleaser CI workflow on: - push: - branches: [main] - paths: - - ".goreleaser.yaml" - - "distributions/otelcol/manifest.yaml" - - "distributions/otelcol-contrib/manifest.yaml" - pull_request: - branches: [main] - paths: - - ".goreleaser.yaml" - - "distributions/otelcol/manifest.yaml" - - "distributions/otelcol-contrib/manifest.yaml" + workflow_call: + inputs: + distribution: + required: true + type: string jobs: check-goreleaser: - name: Check GoReleaser Configuration + name: Check GoReleaser Configuration for ${{ inputs.distribution }} strategy: matrix: - GOOS: [linux, windows, darwin] - GOARCH: ["386", amd64, arm64, ppc64le, arm, s390x] + GOOS: [ linux, windows, darwin ] + GOARCH: [ "386", amd64, arm64, ppc64le, arm, s390x ] exclude: - GOOS: darwin GOARCH: "386" @@ -59,13 +52,13 @@ jobs: - name: Generate the sources run: make generate-sources - - name: Run GoReleaser + - name: Run GoReleaser for ${{ inputs.distribution }} uses: goreleaser/goreleaser-action@v5 with: distribution: goreleaser-pro version: latest - args: --snapshot --clean --skip-sign --skip-sbom --timeout 2h --split + args: --snapshot --clean --skip-sign --skip-sbom --timeout 2h --split --id ${{ inputs.distribution }} env: GOOS: ${{ matrix.GOOS }} GOARCH: ${{ matrix.GOARCH }} - GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} + GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/base-release.yaml similarity index 90% rename from .github/workflows/release.yaml rename to .github/workflows/base-release.yaml index c80e9930..4fc3bba5 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/base-release.yaml @@ -1,11 +1,15 @@ -name: Release +name: Reusable release workflow on: - push: - tags: ["v*"] + workflow_call: + inputs: + distribution: + required: true + type: string jobs: prepare: + name: Prepare ${{ inputs.distribution }} Release strategy: matrix: GOOS: [linux, windows, darwin] @@ -70,7 +74,7 @@ jobs: with: distribution: goreleaser-pro version: latest - args: release --clean --split --timeout 2h + args: release --clean --split --timeout 2h --id $ {{ inputs.distribution }} env: GOOS: ${{ matrix.GOOS }} GOARCH: ${{ matrix.GOARCH }} @@ -84,7 +88,7 @@ jobs: path: dist/*/* release: - name: Release + name: ${{ inputs.distribution }} Release runs-on: ubuntu-20.04 needs: prepare @@ -133,7 +137,7 @@ jobs: with: distribution: goreleaser-pro version: latest - args: continue --merge --timeout 2h + args: continue --merge --timeout 2h --id ${{ inputs.distribution }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} COSIGN_YES: true diff --git a/.github/workflows/ci-goreleaser-contrib.yaml b/.github/workflows/ci-goreleaser-contrib.yaml new file mode 100644 index 00000000..1ff3c4ab --- /dev/null +++ b/.github/workflows/ci-goreleaser-contrib.yaml @@ -0,0 +1,21 @@ +name: Continuous Integration - Contrib - GoReleaser + +on: + push: + branches: [main] + paths: + - ".goreleaser.yaml" + - "distributions/otelcol-contrib/manifest.yaml" + pull_request: + branches: [main] + paths: + - ".goreleaser.yaml" + - "distributions/otelcol-contrib/manifest.yaml" + +jobs: + check-goreleaser: + name: Continuous Integration - Contrib - GoReleaser + uses: ./.github/workflows/base-ci-goreleaser.yaml + with: + distribution: otelcol-contrib + secrets: inherit diff --git a/.github/workflows/ci-goreleaser-core.yaml b/.github/workflows/ci-goreleaser-core.yaml new file mode 100644 index 00000000..5548ce26 --- /dev/null +++ b/.github/workflows/ci-goreleaser-core.yaml @@ -0,0 +1,22 @@ +name: Continuous Integration - Core - GoReleaser + +on: + push: + branches: [main] + paths: + - ".goreleaser.yaml" + - "distributions/otelcol/manifest.yaml" + pull_request: + branches: [main] + paths: + - ".goreleaser.yaml" + - "distributions/otelcol/manifest.yaml" + + +jobs: + check-goreleaser: + name: Continuous Integration - Core - GoReleaser + uses: ./.github/workflows/base-ci-goreleaser.yaml + with: + distribution: otelcol + secrets: inherit diff --git a/.github/workflows/release-contrib.yaml b/.github/workflows/release-contrib.yaml new file mode 100644 index 00000000..08ae253d --- /dev/null +++ b/.github/workflows/release-contrib.yaml @@ -0,0 +1,14 @@ +name: Release Contrib + +on: + push: + tags: ["v*"] + +jobs: + release: + name: Release Contrib + uses: ./.github/workflows/base-release.yaml + with: + distribution: otelcol-contrib + secrets: inherit + permissions: write-all \ No newline at end of file diff --git a/.github/workflows/release-core.yaml b/.github/workflows/release-core.yaml new file mode 100644 index 00000000..4afe385d --- /dev/null +++ b/.github/workflows/release-core.yaml @@ -0,0 +1,14 @@ +name: Release Core + +on: + push: + tags: ["v*"] + +jobs: + release: + name: Release Core + uses: ./.github/workflows/base-release.yaml + with: + distribution: otelcol + secrets: inherit + permissions: write-all diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 3c0d1bb2..09b3d592 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -137,7 +137,9 @@ nfpms: checksum: name_template: '{{ .ProjectName }}_checksums.txt' dockers: - - goos: linux + - ids: + - otelcol + goos: linux goarch: "386" dockerfile: distributions/otelcol/Dockerfile image_templates: @@ -156,7 +158,9 @@ dockers: - --label=org.opencontainers.image.version={{.Version}} - --label=org.opencontainers.image.source={{.GitURL}} use: buildx - - goos: linux + - ids: + - otelcol + goos: linux goarch: amd64 dockerfile: distributions/otelcol/Dockerfile image_templates: @@ -175,7 +179,9 @@ dockers: - --label=org.opencontainers.image.version={{.Version}} - --label=org.opencontainers.image.source={{.GitURL}} use: buildx - - goos: linux + - ids: + - otelcol + goos: linux goarch: arm goarm: "7" dockerfile: distributions/otelcol/Dockerfile @@ -195,7 +201,9 @@ dockers: - --label=org.opencontainers.image.version={{.Version}} - --label=org.opencontainers.image.source={{.GitURL}} use: buildx - - goos: linux + - ids: + - otelcol + goos: linux goarch: arm64 dockerfile: distributions/otelcol/Dockerfile image_templates: @@ -214,7 +222,9 @@ dockers: - --label=org.opencontainers.image.version={{.Version}} - --label=org.opencontainers.image.source={{.GitURL}} use: buildx - - goos: linux + - ids: + - otelcol + goos: linux goarch: ppc64le dockerfile: distributions/otelcol/Dockerfile image_templates: @@ -233,7 +243,9 @@ dockers: - --label=org.opencontainers.image.version={{.Version}} - --label=org.opencontainers.image.source={{.GitURL}} use: buildx - - goos: linux + - ids: + - otelcol + goos: linux goarch: s390x dockerfile: distributions/otelcol/Dockerfile image_templates: @@ -252,7 +264,9 @@ dockers: - --label=org.opencontainers.image.version={{.Version}} - --label=org.opencontainers.image.source={{.GitURL}} use: buildx - - goos: linux + - ids: + - otelcol-contrib + goos: linux goarch: "386" dockerfile: distributions/otelcol-contrib/Dockerfile image_templates: @@ -271,7 +285,9 @@ dockers: - --label=org.opencontainers.image.version={{.Version}} - --label=org.opencontainers.image.source={{.GitURL}} use: buildx - - goos: linux + - ids: + - otelcol-contrib + goos: linux goarch: amd64 dockerfile: distributions/otelcol-contrib/Dockerfile image_templates: @@ -290,7 +306,9 @@ dockers: - --label=org.opencontainers.image.version={{.Version}} - --label=org.opencontainers.image.source={{.GitURL}} use: buildx - - goos: linux + - ids: + - otelcol-contrib + goos: linux goarch: arm goarm: "7" dockerfile: distributions/otelcol-contrib/Dockerfile @@ -310,7 +328,9 @@ dockers: - --label=org.opencontainers.image.version={{.Version}} - --label=org.opencontainers.image.source={{.GitURL}} use: buildx - - goos: linux + - ids: + - otelcol-contrib + goos: linux goarch: arm64 dockerfile: distributions/otelcol-contrib/Dockerfile image_templates: @@ -329,7 +349,9 @@ dockers: - --label=org.opencontainers.image.version={{.Version}} - --label=org.opencontainers.image.source={{.GitURL}} use: buildx - - goos: linux + - ids: + - otelcol-contrib + goos: linux goarch: ppc64le dockerfile: distributions/otelcol-contrib/Dockerfile image_templates: @@ -348,7 +370,9 @@ dockers: - --label=org.opencontainers.image.version={{.Version}} - --label=org.opencontainers.image.source={{.GitURL}} use: buildx - - goos: linux + - ids: + - otelcol-contrib + goos: linux goarch: s390x dockerfile: distributions/otelcol-contrib/Dockerfile image_templates: diff --git a/cmd/goreleaser/internal/configure.go b/cmd/goreleaser/internal/configure.go index a81de8fd..a2ce4e31 100644 --- a/cmd/goreleaser/internal/configure.go +++ b/cmd/goreleaser/internal/configure.go @@ -202,6 +202,9 @@ func DockerImage(imagePrefixes []string, dist, arch, armVersion string) config.D Goos: "linux", Goarch: arch, Goarm: armVersion, + IDs: []string{ + dist, + }, } } diff --git a/go.mod b/go.mod index c776905c..5428e4fe 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/open-telemetry/opentelemetry-collector-releases go 1.21 -toolchain go1.21.3 +toolchain go1.21.7 require ( github.com/goreleaser/goreleaser v1.24.0