Merge pull request #156 from KohlsTechnology/dependabot/github_action… #348
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: | |
- master | |
tags: | |
- v* | |
pull_request: | |
branches: | |
- master | |
jobs: | |
test: | |
strategy: | |
matrix: | |
go-version: [1.21.6] | |
os: [ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Compile | |
run: make build | |
- name: golangci-lint | |
uses: golangci/[email protected] | |
with: | |
version: v1.54.2 | |
skip-pkg-cache: true | |
skip-build-cache: true | |
- name: Test | |
run: make test-unit | |
- name: Upload coverage to Codecov | |
uses: codecov/[email protected] | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
fail_ci_if_error: true | |
files: ./coverage.txt | |
verbose: true | |
- name: Image Build | |
run: make image | |
- name: Install GoReleaser | |
uses: goreleaser/goreleaser-action@v5 | |
with: | |
install-only: true | |
version: v1.20.0 | |
- name: Test GoReleaser | |
run: make test-release | |
deploy: | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.21.6 | |
- name: Prepare | |
id: prep | |
run: | | |
DOCKER_IMAGE=quay.io/kohlstechnology/blackbox-helloworld-responder | |
VERSION=${GITHUB_REF#refs/tags/} | |
TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:latest" | |
echo "tags=${TAGS}" >> $GITHUB_OUTPUT | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to quay.io | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.QUAY_USER }} | |
password: ${{ secrets.QUAY_TOKEN }} | |
registry: quay.io | |
- name: Build and push to quay.io | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.prep.outputs.tags }} | |
platforms: linux/amd64,linux/arm64 | |
- name: Install GoReleaser | |
uses: goreleaser/goreleaser-action@v5 | |
with: | |
install-only: true | |
version: v1.20.0 | |
- name: Run GoReleaser | |
run: make release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |