chore: fix sha image tag #25
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: build | |
on: | |
push: | |
branches: [ master ] | |
tags: [ v* ] | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: set up go 1.22.0 | |
uses: actions/setup-go@v4 | |
with: { go-version: 1.22.0 } | |
- name: checkout | |
uses: actions/checkout@v2 | |
with: { fetch-depth: 0 } | |
- name: build and test | |
run: | | |
go test -v -timeout=100s -covermode=count -coverprofile=$GITHUB_WORKSPACE/profile.cov_tmp ./... | |
cat $GITHUB_WORKSPACE/profile.cov_tmp | grep -v "mock_" > $GITHUB_WORKSPACE/profile.cov | |
working-directory: . | |
env: | |
TZ: "Asia/Almaty" | |
CGO_ENABLED: 0 | |
- name: submit coverage | |
run: | | |
go install github.com/mattn/goveralls@latest | |
$(go env GOPATH)/bin/goveralls -service="github" -coverprofile=$GITHUB_WORKSPACE/profile.cov | |
env: | |
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: run golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.56.2 | |
working-directory: . | |
args: --timeout 5m | |
skip-cache: true | |
skip-pkg-cache: true | |
skip-build-cache: true | |
- name: set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: set up Docker Buildx | |
if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') }} | |
uses: docker/setup-buildx-action@v1 | |
- name: login to ghcr | |
if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') }} | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: build and deploy master image to ghcr | |
if: ${{ github.ref == 'refs/heads/master' }} | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
platforms: linux/amd64,linux/arm/v7,linux/arm64 | |
tags: ghcr.io/semior001/groxy:master,ghcr.io/semior001/groxy:${{ github.sha }} | |
- name: build and deploy tagged (latest) image to ghcr | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
platforms: linux/amd64,linux/arm/v7,linux/arm64 | |
tags: ghcr.io/semior001/groxy:latest,ghcr.io/semior001/groxy:${{ github.ref }} |