CI 🏗 #522
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.20" | |
jobs: | |
lint_test: | |
name: Lint & test code. | |
runs-on: ubuntu-latest | |
env: | |
GOLANGCILINT_VERSION: "v1.51.1" | |
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 | |
env CGO_ENABLED=0 go build -o build ./... | |
- name: Upload binary | |
uses: actions/upload-artifact@v3 | |
with: | |
name: bifrost | |
path: | | |
build/* | |
docs/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/* | |
docs/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 CA | |
uses: redhat-actions/buildah-build@v2 | |
id: build_ca | |
with: | |
image: ${{ github.repository }}-issuer | |
build-args: GO_VERSION=${{ env.GO_VERSION }} | |
extra-args: --target=ca | |
tags: > | |
${{ env.LATEST_TAG }} | |
${{ env.SHORT_SHA }} | |
${{ github.sha }} | |
${{ env.PR_TAG }} | |
${{ github.event.release.tag_name }} | |
containerfiles: Dockerfile | |
- name: Build bifrost | |
uses: redhat-actions/buildah-build@v2 | |
id: build_bifrost | |
with: | |
image: ${{ github.repository }} | |
build-args: GO_VERSION=${{ env.GO_VERSION }} | |
tags: > | |
${{ env.LATEST_TAG }} | |
${{ env.SHORT_SHA }} | |
${{ github.sha }} | |
${{ env.PR_TAG }} | |
${{ github.event.release.tag_name }} | |
containerfiles: Dockerfile | |
- 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_ca.outputs.image }} | |
tags: ${{ steps.build_ca.outputs.tags }} | |
- name: Push bifrost to ghcr.io | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
image: ${{ steps.build_bifrost.outputs.image }} | |
tags: ${{ steps.build_bifrost.outputs.tags }} |