CI #76
Workflow file for this run
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
name: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
release: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
GO_VERSION: 1.19 | |
jobs: | |
lint_test: | |
name: Lint & test code. | |
runs-on: ubuntu-latest | |
env: | |
GOLANGCILINT_VERSION: v1.50 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: ${{ env.GOLANGCILINT_VERSION }} | |
- name: Test | |
run: go test -race -cover ./... | |
build: | |
name: Build binary | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Build binary | |
run: | | |
mkdir build | |
go build -o build ./... | |
- name: Upload binary | |
uses: actions/upload-artifact@v3 | |
with: | |
name: bifrost | |
path: | | |
build/* | |
cmd/issuer/openapi.yaml | |
- name: Update Github release | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: softprops/action-gh-release@v1 | |
with: | |
append_body: true | |
generate_release_notes: true | |
files: | | |
build/* | |
cmd/issuer/openapi.yaml | |
container_images: | |
name: Deploy container images | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@v1 | |
# set env vars | |
- run: echo "SHORT_SHA=$(echo $GITHUB_SHA | cut -c1-8)" >>"$GITHUB_ENV" | |
- if: github.ref == 'refs/heads/main' | |
run: echo "LATEST_TAG=latest" >>"$GITHUB_ENV" | |
- if: github.event_name == 'pull_request' | |
run: echo "PR_TAG=pr-${{ github.event.pull_request.number }}" >>"$GITHUB_ENV" | |
- name: Build bouncer | |
uses: redhat-actions/buildah-build@v2 | |
id: build_bouncer | |
with: | |
image: ${{ github.repository }}-bouncer | |
build-args: GO_VERSION=${{ env.GO_VERSION }} | |
extra-args: --target=bouncer | |
tags: > | |
${{ env.LATEST_TAG }} | |
${{ env.SHORT_SHA }} | |
${{ github.sha }} | |
${{ env.PR_TAG }} | |
${{ github.event.release.tag_name }} | |
containerfiles: Dockerfile | |
- name: Build issuer | |
uses: redhat-actions/buildah-build@v2 | |
id: build_issuer | |
with: | |
image: ${{ github.repository }}-issuer | |
build-args: GO_VERSION=${{ env.GO_VERSION }} | |
extra-args: --target=issuer | |
tags: > | |
${{ env.LATEST_TAG }} | |
${{ env.SHORT_SHA }} | |
${{ github.sha }} | |
${{ env.PR_TAG }} | |
${{ github.event.release.tag_name }} | |
containerfiles: Dockerfile | |
- name: Push bouncer to ghcr.io | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
image: ${{ steps.build_bouncer.outputs.image }} | |
tags: ${{ steps.build_bouncer.outputs.tags }} | |
- name: Push issuer to ghcr.io | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
image: ${{ steps.build_issuer.outputs.image }} | |
tags: ${{ steps.build_issuer.outputs.tags }} |