Skip to content

upgrades golang to 1.25.6 (#103) #10

upgrades golang to 1.25.6 (#103)

upgrades golang to 1.25.6 (#103) #10

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
jobs:
release:
name: Release Container
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6
with:
go-version-file: 'go.mod'
cache: true
- name: Install Task
uses: arduino/setup-task@v2
with:
version: '3.x'
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: task install
- name: Test
run: task test
- name: Setup Ko
uses: ko-build/setup-ko@d006021bd0c28d1ce33a07e7943d48b079944c8d # v0.9
- name: Log in to GitHub Container Registry
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract tag version
id: tag
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Set repository owner lowercase
id: repo_owner
run: echo "OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
- name: Build and push container
id: build
env:
KO_DOCKER_REPO: ghcr.io/${{ steps.repo_owner.outputs.OWNER }}/gofetch
VERSION: ${{ steps.tag.outputs.VERSION }}
CREATION_TIME: $(date -u +'%Y-%m-%dT%H:%M:%SZ')
run: |
# Build and push the container with reproducible build flags
# Ko outputs the full image reference with digest
DIGEST=$(ko build \
--bare \
--sbom=spdx \
--platform=linux/amd64,linux/arm64 \
--base-import-paths \
--tags $VERSION,latest \
./cmd/server)
echo "digest=$DIGEST" >> $GITHUB_OUTPUT
- name: Install Cosign
uses: sigstore/cosign-installer@faadad0cce49287aee09b3a48701e75088a2c6ad # v4.0.0
- name: Sign Image with Cosign
run: |
# Sign the image by digest (immutable reference)
cosign sign -y ${{ steps.build.outputs.digest }}