Skip to content
This repository was archived by the owner on Mar 18, 2026. It is now read-only.

fix(workflows): add checkout step to go.yml and release.yml with fetc… #72

fix(workflows): add checkout step to go.yml and release.yml with fetc…

fix(workflows): add checkout step to go.yml and release.yml with fetc… #72

Workflow file for this run

name: GO
on:
workflow_dispatch:
push:
branches: [ "main" ]
pull_request:
branches: [ "*" ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: 1.23.x
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Install Dependencies
run: |
sudo apt update && sudo apt install -y gcc-aarch64-linux-gnu \
libbtrfs-dev libgpgme-dev libdevmapper-dev \
qemu-user-static binfmt-support
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
args: build --snapshot --clean --timeout=1h
- name: Copy file
run: |
cp dist/sreg_linux_amd64*/sreg sreg
chmod a+x sreg
./sreg version
- name: Upload linux-amd64
uses: actions/upload-artifact@v4
with:
name: sreg-linux-amd64
path: dist/sreg_linux_amd64*/sreg
- name: Upload linux-arm64
uses: actions/upload-artifact@v4
with:
name: sreg-linux-arm64
path: dist/sreg_linux_arm64*/sreg
docker_publish:
name: Docker (${{ matrix.arch }})
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: build
runs-on: ${{ matrix.runner }}
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
runner: ubuntu-24.04
artifact: sreg-linux-amd64
- arch: arm64
runner: ubuntu-24.04-arm
artifact: sreg-linux-arm64
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Download binary artifact
uses: actions/download-artifact@v4
with:
name: ${{ matrix.artifact }}
path: dist-bin
- name: Resolve image owner
id: owner
run: echo "value=$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push docker images
run: |
set -euo pipefail
OWNER="${{ steps.owner.outputs.value }}"
SHORT_SHA="${GITHUB_SHA::7}"
ARCH="${{ matrix.arch }}"
bash scripts/docker-build-push.sh "dist-bin" "${OWNER}" "${ARCH}" "main" "${SHORT_SHA}"
docker_build_pr:
name: Docker Build Only (${{ matrix.arch }})
if: github.event_name == 'pull_request'
needs: build
runs-on: ${{ matrix.runner }}
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
runner: ubuntu-latest
artifact: sreg-linux-amd64
- arch: arm64
runner: ubuntu-24.04-arm
artifact: sreg-linux-arm64
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Download binary artifact
uses: actions/download-artifact@v4
with:
name: ${{ matrix.artifact }}
path: dist-bin
- name: Resolve image owner
id: owner
run: echo "value=$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
- name: Build docker images only
run: |
set -euo pipefail
OWNER="${{ steps.owner.outputs.value }}"
SHORT_SHA="${GITHUB_SHA::7}"
ARCH="${{ matrix.arch }}"
bash scripts/docker-build-push.sh "dist-bin" "${OWNER}" "${ARCH}" "pr-${{ github.event.pull_request.number }}" "${SHORT_SHA}" "no-push"
docker_manifest:
name: Docker Manifests
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: docker_publish
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Resolve image owner
id: owner
run: echo "value=$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create and push manifests
run: |
set -euo pipefail
OWNER="${{ steps.owner.outputs.value }}"
SHORT_SHA="${GITHUB_SHA::7}"
bash scripts/docker-manifest-push.sh "${OWNER}" "main" "${SHORT_SHA}"