Skip to content

Upgrade to Go 1.21 (#78) #224

Upgrade to Go 1.21 (#78)

Upgrade to Go 1.21 (#78) #224

Workflow file for this run

name: build
on:
push:
branches:
- main
tags:
- v**
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Determine Version
run: |
# determine version from tag
export VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3)
if [[ $VERSION != v* ]]
then
export VERSION=""
echo "Building version-less (main or feature branch)"
else
# make version more Docker-friendly by dropping the 'v'
export VERSION=${VERSION:1:${#VERSION}}
echo "Building as ${VERSION}"
fi
echo "##[set-output name=version;]$VERSION"
id: determine_version
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.21
- name: Lint
run: go vet ./...
- name: Build
run: go build ./...
- name: Test
run: go test -v -coverprofile=coverage.cov -coverpkg ./... -covermode=atomic ./...
- uses: codecov/codecov-action@v2.1.0
with:
files: coverage.cov
flags: unittests
- name: Push Release Docker Image
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
docker build -t ghcr.io/oxisto/oauth2go:latest .
docker tag ghcr.io/oxisto/oauth2go:latest ghcr.io/oxisto/oauth2go:$VERSION
docker push ghcr.io/oxisto/oauth2go:$VERSION
docker push ghcr.io/oxisto/oauth2go:latest
if: startsWith(github.ref, 'refs/tags/v')
env:
VERSION: ${{ steps.determine_version.outputs.version }}