CI #77
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: | |
env: | |
GO_VERSION: 1.19 | |
jobs: | |
lint: | |
name: Lint Go 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 }} | |
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/** | |
- 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/** | |
images: | |
if: startsWith(github.ref, 'refs/tags/') | |
name: Build and push images to ghcr.io | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set environment variables | |
run: | | |
echo "SHORT_SHA=$(echo $GITHUB_SHA | cut -c1-8)" >>"$GITHUB_ENV" | |
- name: Build bouncer image | |
uses: redhat-actions/buildah-build@v2 | |
id: build_bouncer_image | |
with: | |
image: ${{ github.repository }}-bouncer | |
build-args: GO_VERSION=${{ env.GO_VERSION }} | |
extra-args: --target=bouncer | |
tags: > | |
latest | |
${{ env.SHORT_SHA }} | |
${{ github.sha }} | |
${{ github.event.release.tag_name }} | |
containerfiles: Dockerfile | |
- name: Build issuer image | |
uses: redhat-actions/buildah-build@v2 | |
id: build_issuer_image | |
with: | |
image: ${{ github.repository }}-issuer | |
build-args: GO_VERSION=${{ env.GO_VERSION }} | |
extra-args: --target=issuer | |
tags: > | |
latest | |
${{ env.SHORT_SHA }} | |
${{ github.sha }} | |
${{ github.event.release.tag_name }} | |
containerfiles: Dockerfile | |
- name: Push bouncer image | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
image: ${{ steps.build_bouncer_image.outputs.image }} | |
tags: ${{ steps.build_bouncer_image.outputs.tags }} | |
- name: Push issuer image | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
image: ${{ steps.build_issuer_image.outputs.image }} | |
tags: ${{ steps.build_issuer_image.outputs.tags }} |