Update build.yml #13
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
# This workflow will build a golang project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | |
name: Latest Build | |
on: | |
push: | |
branches: [ "main" ] | |
tags: | |
- v* | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build_latest: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.20' | |
- name: Build Go | |
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./.build/main ./cmd | |
- name: Test Go | |
run: go test -v ./... | |
- name: Build and push latest image | |
run: | | |
docker login --username pommes --password ${{ secrets.GHCR_IMAGE_REGISTRY_SECRET }} ghcr.io | |
docker build . --tag ghcr.io/pommes/nginx-proxy-metrics:latest | |
docker push ghcr.io/pommes/nginx-proxy-metrics:latest | |