Skip to content
This repository has been archived by the owner on Sep 20, 2022. It is now read-only.

Commit

Permalink
Add release workflow (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
travisgroth authored Feb 14, 2020
1 parent 9c9d330 commit cf4d77a
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.kubebuilder
pomerium-operator
**/debug.test
dist/*
bin/*
6 changes: 3 additions & 3 deletions .github/workflows/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
- name: Docker Build
run: docker build .

publish-docker:
publish-docker-snapshot:
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
runs-on: ubuntu-latest
needs:
Expand All @@ -89,10 +89,10 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: pomerium/pomerium-operator

- name: Docker Publish - Latest
- name: Docker Publish - Master
uses: zenato/docker-action@master
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: pomerium/pomerium-operator
tag: latest
tag: master
66 changes: 66 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Release
on:
release:
types:
- published

jobs:
release-binary:
runs-on: ubuntu-latest
container:
image: "golang:1.13"
strategy:
matrix:
os:
- darwin
- linux
arch:
- amd64
steps:
- name: Check out code
uses: actions/[email protected]

- name: Install go-task
run: curl -sL https://taskfile.dev/install.sh | sh

- name: Release
run: GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} bin/task release

- name: Upload binaries to release
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/*
file_glob: true
tag: ${{ github.ref }}
overwrite: true

release-docker:
needs:
- release-binary
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/[email protected]

- name: Get tag name
id: tagName
uses: olegtarasov/get-tag@v1

- name: Docker Publish - Release
uses: zenato/docker-action@master
continue-on-error: true
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: pomerium/pomerium-operator
tag: ${{ steps.tagName.outputs.tag }}

- name: Docker Publish - Latest
if: "!contains(steps.tagName.outputs.tag, 'rc')"
uses: zenato/docker-action@master
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: pomerium/pomerium-operator
tag: latest
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,5 @@ coverage.txt
/.kubebuilder
.test*.yaml
test*.yaml
/dist/*
/bin/*
10 changes: 10 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ vars:
sh: go env GOARCH
kbversion: 2.2.0
kbdir: ./.kubebuilder
checksum_cmd: "shasum -a 256"

env:
KUBEBUILDER_ASSETS: "{{.kbdir}}/bin"
Expand Down Expand Up @@ -42,6 +43,15 @@ tasks:
- ./go.mod
- ./go.sum

release:
desc: Generate release assets
vars:
BINARY: pomerium-operator-{{.os}}-{{.arch}}
cmds:
- mkdir -p ./dist
- go build -o dist/{{.BINARY}} cmd/pomerium-operator/*.go
- cd dist && {{.checksum_cmd}} {{.BINARY}} > {{.BINARY}}.sha256

run:
desc: Run in debug mode with $ARGS as arguments
cmds:
Expand Down

0 comments on commit cf4d77a

Please sign in to comment.