Skip to content

name updates

name updates #15

Workflow file for this run

name: Build
on:
push:
# Allows manual bumps by API trigger
workflow_dispatch:
inputs:
go_version:
description: 'Go version without the "go" prefix'
required: false
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
concurrency:
group: gotify-build-lock
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Extract input options
if: ${{ github.event.inputs.go_version }}
run: |
export GO_VERSION=${{ github.event.inputs.go_version }}
echo $GO_VERSION > GO_VERSION
- name: Sanity check
run: |
GO_VERSION=$(cat GO_VERSION)
MATCHES=$(curl -fsSL 'https://go.dev/dl/?mode=json&include=all' | jq --arg GO_VERSION "$GO_VERSION" -r 'map(select(.version == "go\($GO_VERSION)")) | length')
if [ "$MATCHES" -ne 1 ]; then
echo "Invalid Go version: $GO_VERSION, found $MATCHES matches"
exit 1
fi
- name: Build
run: make build
- name: Push and tag
# push if we are not already tagged, the workflow is triggered by a manual go_version input or we are on master
if: ${{ !startsWith(github.ref, 'refs/tags/v') && (github.event.inputs.go_version || github.ref == 'refs/heads/master') }}
run: |
GO_VERSION=$(cat GO_VERSION)
if git tag --list "v${GO_VERSION}" | grep -q "v${GO_VERSION}"; then
echo "Tag v${GO_VERSION} already exists"
exit 1
fi
if ! git diff --quiet; then
echo "Working directory is dirty, committing changes"
git add GO_VERSION
git commit -m "Bump to Go $GO_VERSION"
if ! git diff --quiet; then
echo "Worktree is still dirty, something went wrong"
exit 1
fi
fi
if ! make push; then
echo "Failed to push tags"
exit 1
fi
git push origin master
git tag -s "v${GO_VERSION}" -m "Bump to Go $GO_VERSION"
git push origin --tags