-
Notifications
You must be signed in to change notification settings - Fork 562
Integrate goreleaser to produce draft releases when new tags are pushed #2365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
timflannagan
merged 5 commits into
operator-framework:master
from
timflannagan:integrate-goreleaser
Sep 24, 2021
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9820057
Makefile: Avoid hardcoding the quay repository in the release target
timflannagan fd548d2
Integrate goreleaser to automate the building and publishing of multi…
timflannagan f0c2856
.github/workflows: Add a release workflow for creating draft releases
timflannagan 829d724
.goreleaser: Add support for ppc64le and s390x architectures
timflannagan 4dc01ae
.github/workflows: Avoid using the latest goreleaser action version
timflannagan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: release | ||
on: | ||
pull_request: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.16 | ||
|
||
- name: Get the image tag | ||
if: startsWith(github.ref, 'refs/tags') | ||
run: | | ||
# Source: https://i.8713187.xyzmunity/t/how-to-get-just-the-tag-name/16241/32 | ||
if [[ $GITHUB_REF == refs/tags/* ]]; then | ||
echo IMAGE_TAG="${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | ||
fi | ||
|
||
- name: Create a draft release | ||
uses: actions/create-release@v1 | ||
id: release | ||
if: startsWith(github.ref, 'refs/tags') | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
draft: true | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ github.ref }} | ||
|
||
- name: Docker Login | ||
uses: docker/login-action@v1 | ||
if: startsWith(github.ref, 'refs/tags') | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.QUAY_USERNAME }} | ||
password: ${{ secrets.QUAY_PASSWORD }} | ||
|
||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
if: startsWith(github.ref, 'refs/tags') | ||
with: | ||
version: 0.177.0 | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
IMAGE_REPO: ${{ secrets.QUAY_USERNAME }}/olm | ||
PKG: github.com/operator-framework/operator-lifecycle-manager | ||
|
||
- name: Generate quickstart release manifests | ||
if: startsWith(github.ref, 'refs/tags') | ||
run: make release ver=${{ env.IMAGE_TAG }} IMAGE_REPO=quay.io/${{ secrets.QUAY_USERNAME }}/olm | ||
|
||
- name: Update release artifacts with rendered Kubernetes manifests | ||
uses: softprops/action-gh-release@v1 | ||
if: startsWith(github.ref, 'refs/tags') | ||
with: | ||
name: ${{ env.IMAGE_TAG }} | ||
files: | | ||
deploy/upstream/quickstart/crds.yaml | ||
deploy/upstream/quickstart/olm.yaml | ||
deploy/upstream/quickstart/install.sh | ||
draft: true | ||
token: ${{ github.token }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -455,3 +455,5 @@ apiserver.key | |
|
||
!vendor/** | ||
test/e2e-local.image.tar | ||
|
||
dist/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
env: | ||
- GO111MODULE=on | ||
- CGO_ENABLED=0 | ||
before: | ||
hooks: | ||
- go mod tidy | ||
- go mod vendor | ||
builds: | ||
- id: olm | ||
main: ./cmd/olm | ||
binary: olm | ||
goos: | ||
- linux | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
- ppc64le | ||
- s390x | ||
tags: | ||
- json1 | ||
flags: | ||
- -mod=vendor | ||
ldflags: | ||
- -X {{ .Env.PKG }}/pkg/version.GitCommit={{ .FullCommit }} | ||
- -X {{ .Env.PKG }}/pkg/version.OLMVersion={{ .Tag }} | ||
- id: catalog | ||
main: ./cmd/catalog | ||
binary: catalog | ||
goos: | ||
- linux | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
- ppc64le | ||
- s390x | ||
tags: | ||
- json1 | ||
flags: | ||
- -mod=vendor | ||
ldflags: | ||
- -X {{ .Env.PKG }}/pkg/version.GitCommit={{ .FullCommit }} | ||
- -X {{ .Env.PKG }}/pkg/version.OLMVersion={{ .Tag }} | ||
- id: cpb | ||
main: ./util/cpb | ||
binary: cpb | ||
goos: | ||
- linux | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
- ppc64le | ||
- s390x | ||
tags: | ||
- json1 | ||
flags: | ||
- -mod=vendor | ||
ldflags: | ||
- -X {{ .Env.PKG }}/pkg/version.GitCommit={{ .FullCommit }} | ||
- -X {{ .Env.PKG }}/pkg/version.OLMVersion={{ .Tag }} | ||
- id: package-server | ||
main: ./cmd/package-server | ||
binary: package-server | ||
goos: | ||
- linux | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
- ppc64le | ||
- s390x | ||
tags: | ||
- json1 | ||
flags: | ||
- -mod=vendor | ||
ldflags: | ||
- -X {{ .Env.PKG }}/pkg/version.GitCommit={{ .FullCommit }} | ||
- -X {{ .Env.PKG }}/pkg/version.OLMVersion={{ .Tag }} | ||
dockers: | ||
- image_templates: | ||
- quay.io/{{ .Env.IMAGE_REPO }}:{{ .Tag }}-amd64 | ||
dockerfile: Dockerfile.goreleaser | ||
use: buildx | ||
goos: linux | ||
goarch: amd64 | ||
build_flag_templates: | ||
- --platform=linux/amd64 | ||
- image_templates: | ||
- quay.io/{{ .Env.IMAGE_REPO }}:{{ .Tag }}-arm64 | ||
dockerfile: Dockerfile.goreleaser | ||
use: buildx | ||
goos: linux | ||
goarch: arm64 | ||
build_flag_templates: | ||
- --platform=linux/arm64 | ||
- image_templates: | ||
- quay.io/{{ .Env.IMAGE_REPO }}:{{ .Tag }}-ppc64le | ||
dockerfile: Dockerfile.goreleaser | ||
use: buildx | ||
goos: linux | ||
goarch: ppc64le | ||
build_flag_templates: | ||
- --platform=linux/ppc64le | ||
- image_templates: | ||
- quay.io/{{ .Env.IMAGE_REPO }}:{{ .Tag }}-s390x | ||
dockerfile: Dockerfile.goreleaser | ||
use: buildx | ||
goos: linux | ||
goarch: s390x | ||
build_flag_templates: | ||
- --platform=linux/s390x | ||
docker_manifests: | ||
- name_template: quay.io/{{ .Env.IMAGE_REPO }}:v{{ .Major }}.{{ .Minor }} | ||
image_templates: | ||
- quay.io/{{ .Env.IMAGE_REPO }}:{{ .Tag }}-amd64 | ||
- quay.io/{{ .Env.IMAGE_REPO }}:{{ .Tag }}-arm64 | ||
- quay.io/{{ .Env.IMAGE_REPO }}:{{ .Tag }}-ppc64le | ||
- quay.io/{{ .Env.IMAGE_REPO }}:{{ .Tag }}-s390x | ||
- name_template: quay.io/{{ .Env.IMAGE_REPO }}:{{ .Tag }} | ||
image_templates: | ||
- quay.io/{{ .Env.IMAGE_REPO }}:{{ .Tag }}-amd64 | ||
- quay.io/{{ .Env.IMAGE_REPO }}:{{ .Tag }}-arm64 | ||
- quay.io/{{ .Env.IMAGE_REPO }}:{{ .Tag }}-ppc64le | ||
- quay.io/{{ .Env.IMAGE_REPO }}:{{ .Tag }}-s390x | ||
checksum: | ||
name_template: 'checksums.txt' | ||
snapshot: | ||
name_template: "{{ .Tag }}" | ||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^doc:' | ||
- '^test:' | ||
release: | ||
draft: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM --platform=$BUILDPLATFORM gcr.io/distroless/static:debug | ||
LABEL stage=olm | ||
WORKDIR / | ||
# bundle unpack Jobs require cp at /bin/cp | ||
RUN ["/busybox/ln", "-s", "/busybox/cp", "/bin/cp"] | ||
# copy goreleaser built binaries | ||
COPY olm /bin/olm | ||
COPY catalog /bin/catalog | ||
COPY package-server /bin/package-server | ||
COPY cpb /bin/cpb | ||
EXPOSE 8080 | ||
EXPOSE 5443 | ||
ENTRYPOINT ["/bin/olm"] |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably need to add the
--snapshot
flag anytime we're not pushing images.FYI - opm also pushes a
master
image on every push to master for folks that want to live on the edge :) It can be nice to have that, but definitely non-blocking.