build: perform a docker build on each checkin #19
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
on: | |
push: | |
branches: | |
- "**" | |
name: Build | |
env: | |
GO_VERSION: 1.22 | |
REPO: ${{github.repository}} | |
jobs: | |
build: | |
name: Run checks and build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{env.GO_VERSION}} | |
- name: Vet | |
run: make vet | |
- name: Test | |
run: make test | |
- name: Build | |
run: make | |
docker-build: | |
runs-on: ubuntu-latest | |
name: Build the docker image | |
steps: | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Build Image | |
run: make image IMAGE=ghcr.io/${{env.REPO}}:${{ github.ref_name }} | |
- name: Push | |
run: docker push ghcr.io/${{env.REPO}}:${{ github.ref_name }} | |
format: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{env.GO_VERSION}} | |
- run: go fmt ./... | |
- name: Verify No Differences after format | |
run: test -z "$(git diff)" |