This repository has been archived by the owner on Sep 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from font/release
Add GitHub Actions workflow to automate releases
- Loading branch information
Showing
4 changed files
with
1,125 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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,85 @@ | ||
name: Create Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' # tags matching v*, i.e. v0.0.1, v1.0.0-rc.0 | ||
|
||
jobs: | ||
build: | ||
name: Create Release | ||
runs-on: ubuntu-18.04 | ||
strategy: | ||
matrix: | ||
go: [ '1.15' ] | ||
steps: | ||
- name: Set Up Environment Variables | ||
env: | ||
REPO: quay.io/${{ secrets.QUAY_ACCOUNT_NAME }} | ||
IMG: gatekeeper-operator | ||
run: | | ||
echo "REPO=${REPO}" >> ${GITHUB_ENV} | ||
RELEASE_VERSION=${{ github.ref }} | ||
# Removes the 'refs/tags/' portion of the string i.e. 'refs/tags/v0.0.1' to 'v0.0.1' | ||
echo "RELEASE_VERSION=${RELEASE_VERSION##*/}" >> ${GITHUB_ENV} | ||
RELEASE_IMG="${REPO}/${IMG}" | ||
echo "RELEASE_IMG=${RELEASE_IMG}" >> ${GITHUB_ENV} | ||
echo "RELEASE_BUNDLE_IMG=${RELEASE_IMG}-bundle" >> ${GITHUB_ENV} | ||
echo "RELEASE_BUNDLE_INDEX_IMG=${RELEASE_IMG}-bundle-index" >> ${GITHUB_ENV} | ||
- uses: actions/checkout@v2 | ||
- uses: docker/setup-qemu-action@v1 | ||
- uses: docker/setup-buildx-action@v1 | ||
with: | ||
driver-opts: image=moby/buildkit:v0.8-beta | ||
- uses: docker/login-action@v1 | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.QUAY_USERNAME }} | ||
password: ${{ secrets.QUAY_TOKEN }} | ||
- uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
platforms: linux/amd64 | ||
pull: true | ||
push: true | ||
tags: | | ||
${{ env.RELEASE_IMG }}:${{ env.RELEASE_VERSION }} | ||
${{ env.RELEASE_IMG }}:latest | ||
- name: Build and Push Bundle Image | ||
run: | | ||
make bundle-build VERSION=${RELEASE_VERSION} | ||
docker tag ${RELEASE_BUNDLE_IMG}:${RELEASE_VERSION} ${RELEASE_BUNDLE_IMG}:latest | ||
make docker-push IMG=${RELEASE_BUNDLE_IMG}:${RELEASE_VERSION} | ||
make docker-push IMG=${RELEASE_BUNDLE_IMG}:latest | ||
- name: Set Up Go to Install OPM | ||
uses: actions/setup-go@v2 | ||
id: go | ||
with: | ||
go-version: ${{ matrix.go }} | ||
|
||
- name: Build and Push Bundle Index Image | ||
run: | | ||
make bundle-index-build VERSION=${RELEASE_VERSION} | ||
docker tag ${RELEASE_BUNDLE_INDEX_IMG}:${RELEASE_VERSION} ${RELEASE_BUNDLE_INDEX_IMG}:latest | ||
make docker-push IMG=${RELEASE_BUNDLE_INDEX_IMG}:${RELEASE_VERSION} | ||
make docker-push IMG=${RELEASE_BUNDLE_INDEX_IMG}:latest | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions. | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Gatekeeper Operator ${{ github.ref }} | ||
body: | | ||
To install the Gatekeeper Operator: | ||
``` | ||
kubectl apply -f https://raw.githubusercontent.com/${{ github.repository }}/${{ env.RELEASE_VERSION }}/deploy/gatekeeper-operator.yaml | ||
``` | ||
draft: false | ||
prerelease: false |
This file contains 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
Oops, something went wrong.