-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (81 loc) · 2.85 KB
/
release.yml
File metadata and controls
98 lines (81 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# SPDX-FileCopyrightText: Copyright 2025 Stacklok, Inc.
# SPDX-License-Identifier: Apache-2.0
name: Release
on:
push:
tags:
- 'v*'
permissions: {}
env:
GOPRIVATE: github.com/stacklok/*
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@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
with:
go-version-file: 'go.mod'
cache: true
- name: Configure Git for private modules
run: |
git config --global url."https://${{ github.actor }}:${{ secrets.GO_MODULE_TOKEN }}@github.com/".insteadOf "https://github.com/"
- name: Install Task
uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2
with:
version: '3.x'
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Test
run: task test
- name: Build init
run: task build-init
- 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
env:
REPO_OWNER: ${{ github.repository_owner }}
run: echo "OWNER=$(echo "$REPO_OWNER" | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
- name: Build and push container
env:
KO_DOCKER_REPO: ghcr.io/${{ steps.repo_owner.outputs.OWNER }}/waggle
VERSION: ${{ steps.tag.outputs.VERSION }}
CREATION_TIME: ${{ github.event.head_commit.timestamp }}
run: |
ko build \
--bare \
--sbom=spdx \
--platform=linux/amd64,linux/arm64 \
--tags $VERSION,latest \
./cmd/waggle
- name: Install Cosign
uses: sigstore/cosign-installer@ba7bc0a3fef59531c69a25acd34668d6d3fe6f22 # v4.1.0
- name: Sign Image with Cosign
env:
KO_DOCKER_REPO: ghcr.io/${{ steps.repo_owner.outputs.OWNER }}/waggle
TAG_VERSION: ${{ steps.tag.outputs.VERSION }}
GH_REF: ${{ github.ref }}
run: |
TAG=$(echo "$TAG_VERSION" | sed 's/+/_/g')
cosign sign -y "$KO_DOCKER_REPO:$TAG"
if [[ "$GH_REF" == refs/tags/* ]]; then
cosign sign -y "$KO_DOCKER_REPO:latest"
fi