name: CI on: push: pull_request: workflow_dispatch: env: FORGE: codeberg.org jobs: check: runs-on: debian-trixie container: image: docker.io/library/node:24-trixie-slim@sha256:28fd420825d8e922eab0fd91740c7cf88ddbdc8116a2b20a82049f0c946feb03 steps: - name: Check out source code uses: https://code.forgejo.org/actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Set up toolchain uses: https://code.forgejo.org/actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 with: go-version: '>=1.25.6' - name: Install dependencies run: | apt-get -y update apt-get -y install ca-certificates go install honnef.co/go/tools/cmd/staticcheck@latest - name: Build service run: | go build - name: Run tests run: | go test ./... - name: Run static analysis run: | go vet ./... staticcheck ./... release: # IMPORTANT: This workflow step will not work without the Releases unit enabled! if: ${{ forge.ref == 'refs/heads/main' || startsWith(forge.event.ref, 'refs/tags/v') }} needs: [check] runs-on: debian-trixie container: image: docker.io/library/node:24-trixie-slim@sha256:28fd420825d8e922eab0fd91740c7cf88ddbdc8116a2b20a82049f0c946feb03 steps: - name: Install dependencies run: | apt-get -y update apt-get -y install ca-certificates git # git needs to be installed for build information embedding to work - name: Check out source code uses: https://code.forgejo.org/actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 fetch-tags: true - name: Set up toolchain uses: https://code.forgejo.org/actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 with: go-version: '>=1.25.6' - name: Build release assets # If you want more platforms to be represented, send a pull request. run: | set -x build() { GOOS=$1 GOARCH=$2 go build -o assets/git-pages.$1-$2$3; } build windows amd64 .exe build linux amd64 build linux arm64 build darwin arm64 - name: Create release uses: https://code.forgejo.org/actions/forgejo-release@6a9510a9ea01b8b9b435933bf3c0fa45597ad530 # v2.11.3 with: tag: ${{ startsWith(forge.event.ref, 'refs/tags/v') && forge.ref_name || 'latest' }} release-dir: assets direction: upload override: true prerelease: ${{ !startsWith(forge.event.ref, 'refs/tags/v') }} package: if: ${{ forge.ref == 'refs/heads/main' || startsWith(forge.event.ref, 'refs/tags/v') }} needs: [check] runs-on: debian-trixie container: image: docker.io/library/node:24-trixie-slim@sha256:28fd420825d8e922eab0fd91740c7cf88ddbdc8116a2b20a82049f0c946feb03 steps: - name: Install dependencies run: | apt-get -y update apt-get -y install ca-certificates buildah qemu-user-binfmt - name: Check out source code uses: https://code.forgejo.org/actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Authenticate with Docker run: | buildah login --authfile=/tmp/authfile-${FORGE}.json \ -u ${{ vars.PACKAGES_USER }} -p ${{ secrets.PACKAGES_TOKEN }} ${FORGE} - name: Build container run: | printf '[storage]\ndriver="vfs"\nrunroot="/run/containers/storage"\ngraphroot="/var/lib/containers/storage"\n' | tee /etc/containers/storage.conf buildah build ${CACHE} --arch=amd64 --tag=container:${VER}-amd64 buildah build ${CACHE} --arch=arm64 --tag=container:${VER}-arm64 buildah manifest create container:${VER} \ container:${VER}-amd64 \ container:${VER}-arm64 env: BUILDAH_ISOLATION: chroot VER: ${{ startsWith(forge.event.ref, 'refs/tags/v') && forge.ref_name || 'latest' }} CACHE: ${{ format('--authfile=/tmp/authfile-{0}.json --layers --cache-from {0}/{1}/cache --cache-to {0}/{1}/cache', env.FORGE, forge.repository) }} - if: ${{ forge.repository == 'git-pages/git-pages' }} name: Push container to Codeberg run: | buildah manifest push --authfile=/tmp/authfile-${FORGE}.json \ --all container:${VER} "docker://${FORGE}/${{ forge.repository }}:${VER/v/}" env: VER: ${{ startsWith(forge.event.ref, 'refs/tags/v') && forge.ref_name || 'latest' }}