Skip to content

Tagged Release

Tagged Release #260

Workflow file for this run

name: Tagged Release
on:
create:
tags:
- 'v*'
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=${{ steps.checkout.outputs.tag }}'" -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 }}