fixup! add newline in autoReplace #26
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: | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
concurrency: | |
group: gotify-build-lock | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- 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: Login to Docker | |
if: ${{ !startsWith(github.ref, 'refs/tags/v') && github.ref == 'refs/heads/master' }} | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_PASS }} | |
- 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.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 ! make push; then | |
echo "Failed to push tags" | |
exit 1 | |
fi | |
git config user.name "gotifyci" | |
git config user.email "[email protected]" | |
git tag "v${GO_VERSION}" -m "Bump to Go $GO_VERSION" | |
git push origin --tags |