gatus/.github/workflows/release.yml
selfhoster1312 7e82dedfaf
All checks were successful
Release / Build gatus with pre-packaged web assets (push) Successful in 2m46s
wip: move to forgejo actions
2026-08-18 21:39:53 +02:00

143 lines
4.8 KiB
YAML

name: Release
env:
PKG_VERSION: "2026.07.28"
# TODO: actions/checkout only supports GITHUB repos...
GATUS_REPO: "https://github.com/selfhoster1312/gatus"
GATUS_REF: "d65a3321f1291aa419870a04896aa65fc4c78cf4"
# 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:
cancel-in-progress: false
permissions:
contents: write
jobs:
build:
name: Build gatus with pre-packaged web assets
runs-on: docker
steps:
- name: Copy source repo
run: |
git clone "${{ env.GATUS_REPO }}" .
git checkout "${{ env.GATUS_REF }}"
- name: Checkout sources for packaging
run: |
git clone "${{ forgejo.server_url }}/${{ forgejo.repository }}" __CI_PREBUILD__
cd __CI_PREBUILD__
git checkout "${{ forgejo.sha }}"
cd ..
- uses: actions/setup-go@v6
with:
go-version: 1.26.3
- name: Prepare dist folder and debian bin folder
run: |
mkdir -p dist
mkdir -p __CI_PREBUILD__/debian/gatus/usr/local/bin/
- name: Build binary for amd64
run: |
go build -o dist/gatus-amd64
cp dist/gatus-amd64 __CI_PREBUILD__/debian/gatus/usr/local/bin/gatus
- name: Build deb for amd64
uses: https://github.com/jiro4989/build-deb-action@86e86ceb88b13157fa569663d43c89346505fc3e
with:
package: gatus
package_root: __CI_PREBUILD__/debian/gatus
maintainer: selfhoster1312
version: ${{ env.PKG_VERSION }}
arch: amd64
id: build-deb-amd64
- name: Build binary for arm64
run: |
GOARCH="arm64" go build -o dist/gatus-arm64
cp dist/gatus-arm64 __CI_PREBUILD__/debian/gatus/usr/local/bin/gatus
- name: Build deb for arm64
uses: https://github.com/jiro4989/build-deb-action@86e86ceb88b13157fa569663d43c89346505fc3e
with:
package: gatus
package_root: __CI_PREBUILD__/debian/gatus
maintainer: selfhoster1312
version: ${{ env.PKG_VERSION }}
arch: arm64
id: build-deb-arm64
- name: Compute deb filename
run: |
cat <<EOF >>$GITHUB_ENV
ARM64_DEB_FILENAME=$(basename ${{ steps.build-deb-arm64.outputs.file_name }})
AMD64_DEB_FILENAME=$(basename ${{ steps.build-deb-amd64.outputs.file_name }})
EOF
- name: Upload binaries to release
uses: actions/forgejo-release@v2.13.4
if: env.preview == 'false'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/*
file_glob: true
tag: ${{ github.ref_name }}
overwrite: true
- name: Upload amd64 deb to release
uses: actions/forgejo-release@v2.13.4
if: env.preview == 'false'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.build-deb-amd64.outputs.file_name }}
tag: ${{ github.ref_name }}
overwrite: true
- name: Upload arm64 deb to release
uses: actions/forgejo-release@v2.13.4
if: env.preview == 'false'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
path: ${{ steps.build-deb-arm64.outputs.file_name }}
tag: ${{ github.ref_name }}
overwrite: true
- name: Upload gatus-amd64 as artifact
uses: https://code.forgejo.org/forgejo/upload-artifact@v3
if: env.preview == 'true'
with:
name: gatus-amd64
path: dist/gatus-amd64
archive: false
- name: Upload gatus-amd64 deb as artifact
uses: https://code.forgejo.org/forgejo/upload-artifact@v3
if: env.preview == 'true'
with:
name: ${{ env.AMD64_DEB_FILENAME }}
path: ${{ steps.build-deb-amd64.outputs.file_name }}
archive: false
- name: Upload gatus-arm64 as artifact
uses: https://code.forgejo.org/forgejo/upload-artifact@v3
if: env.preview == 'true'
with:
name: gatus-arm64
path: dist/gatus-arm64
archive: false
- name: Upload gatus-arm64 deb as artifact
uses: https://code.forgejo.org/forgejo/upload-artifact@v3
if: env.preview == 'true'
with:
name: ${{ env.ARM64_DEB_FILENAME }}
path: ${{ steps.build-deb-arm64.outputs.file_name }}
archive: false