-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (102 loc) · 2.92 KB
/
Copy pathrelease.yml
File metadata and controls
117 lines (102 loc) · 2.92 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# SPDX-FileCopyrightText: 2026 Josef Gallmetzer
#
# SPDX-License-Identifier: CC0-1.0
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
version:
description: Existing tag to release, for example v0.4.0
required: true
type: string
permissions:
contents: write
id-token: write
attestations: write
artifact-metadata: write
jobs:
build:
name: Build ${{ matrix.goos }}/${{ matrix.goarch }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- goos: linux
goarch: amd64
- goos: linux
goarch: arm64
- goos: darwin
goarch: amd64
- goos: darwin
goarch: arm64
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true
- name: Resolve version metadata
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "VERSION=${{ inputs.version }}" >> "$GITHUB_ENV"
else
echo "VERSION=${GITHUB_REF_NAME}" >> "$GITHUB_ENV"
fi
echo "COMMIT=${GITHUB_SHA::12}" >> "$GITHUB_ENV"
echo "DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_ENV"
- name: Build archive
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: scripts/build-release.sh
- name: Build Debian package
if: matrix.goos == 'linux'
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: scripts/build-deb.sh
- name: Upload archive
uses: actions/upload-artifact@v7
with:
name: odh-${{ matrix.goos }}-${{ matrix.goarch }}
path: dist/*
publish:
name: Publish GitHub release
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Download archives
uses: actions/download-artifact@v7
with:
path: dist
merge-multiple: true
- name: Resolve release tag
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "VERSION=${{ inputs.version }}" >> "$GITHUB_ENV"
else
echo "VERSION=${GITHUB_REF_NAME}" >> "$GITHUB_ENV"
fi
- name: Generate checksum manifest
run: scripts/build-checksums.sh
- name: Attest release artifacts
uses: actions/attest@v4
with:
subject-checksums: dist/SHA256SUMS
- name: Publish release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "$VERSION" dist/* \
--repo "$GITHUB_REPOSITORY" \
--title "$VERSION" \
--notes "Automated odh CLI release for $VERSION." \
--verify-tag