gatus/.github/workflows/release.yml
2026-07-08 17:37:41 +02:00

75 lines
2.1 KiB
YAML

name: Release
env:
# TODO: actions/checkout only supports GITHUB repos...
GATUS_REPO: "selfhoster1312/gatus"
GATUS_REF: "fork"
# Preview mode: Publishes the build output as a CI artifact instead of creating
# a release, allowing for manual inspection of the output. This mode is
# activated if the CI run was triggered by events other than pushed tags, or
# if the repository is a fork.
preview: ${{ !startsWith(github.ref, 'refs/tags/') || github.repository != 'ci-prebuild/gatus' }}
on:
push:
tags:
- '[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+'
branches:
- 'patch/ci-release-*'
- 'main'
pull_request:
paths:
- '.github/workflows/release.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: read
jobs:
build:
name: Build gatus with pre-packaged web assets
runs-on: ubuntu-22.04
steps:
- name: Checkout sources
uses: actions/checkout@v7
with:
repository: "${{ env.GATUS_REPO }}"
ref: "${{ env.GATUS_REF }}"
- uses: actions/setup-go@v6
with:
go-version: 1.26.3
- name: Prepare dist folder
run: mkdir -p dist
- name: Build binary for amd64
run: go build -o dist/gatus-amd64
- name: Build binary for arm64
run: GOARCH="arm64" go build -o dist/gatus-arm64
- name: Upload binaries to release
uses: svenstaro/upload-release-action@29e53e917877a24fad85510ded594ab3c9ca12de # 2.11.5
if: env.preview == 'false'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/*
file_glob: true
tag: ${{ github.ref_name }}
overwrite: true
- name: Upload gatus-amd64 as artifact
uses: actions/upload-artifact@v7
if: env.preview == 'true'
with:
name: gatus-amd64
path: dist/gatus-amd64
archive: false
- name: Upload gatus-arm64 as artifact
uses: actions/upload-artifact@v7
if: env.preview == 'true'
with:
name: gatus-arm64
path: dist/gatus-arm64
archive: false