Merge pull request #286 from compscidr/renovate/golang-1.x #184
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: Untagged workflow | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go 1.20.0 | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.20.0 | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
- name: Get tag information | |
id: checkout | |
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} | |
- name: Get dependencies | |
run: | | |
go get -v -t -d ./... | |
if [ -f Gopkg.toml ]; then | |
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh | |
dep ensure | |
fi | |
- name: Build | |
run: go build -ldflags="-X 'main.Version=latest'" -v . | |
- name: Test | |
run: go test -race -coverprofile=coverage.txt -covermode=atomic goblog/... | |
- name: Code Coveralls | |
run: bash <(curl -s https://codecov.io/bash) | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Dockerhub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
# https://github.com/marketplace/actions/build-and-push-docker-images#Example-usage | |
- name: Build and push tag | |
id: docker_build | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
build-args: | | |
VERSION=${{ steps.checkout.outputs.tag }} | |
tags: compscidr/goblog:${{ steps.checkout.outputs.tag }} |