-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (80 loc) · 2.48 KB
/
release.yml
File metadata and controls
94 lines (80 loc) · 2.48 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
name: release
run-name: release ${{ github.event.release.tag_name }}
on:
release:
types: [published]
env:
GO_VERSION: "1.23.4"
jobs:
precheck:
runs-on: ubuntu-24.04
outputs:
tag: ${{ steps.parsetag.outputs.tag }}
prerelease: ${{ steps.parsetag.outputs.prerelease }}
env:
TAG: ${{ github.event.release.tag_name }}
steps:
- name: Check version tag
id: parsetag
run: |
if [[ ! "$TAG" =~ ^([0-9]+\.[0-9]+\.[0-9]+)(-.*)?$ ]]; then
echo "Tag must be in semver format without 'v' prefix (e.g., 1.0.0, 2.1.0-rc1)"
exit 1
fi
TAG=${BASH_REMATCH[1]}${BASH_REMATCH[2]:-}
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
# Detect prerelease tags (use GitHub's prerelease flag)
echo "prerelease=${{ github.event.release.prerelease }}" >> "$GITHUB_OUTPUT"
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.release.tag_name }}
test:
runs-on: ubuntu-24.04
needs: [precheck]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.release.tag_name }}
- name: Setup Go with private modules
uses: ./.github/actions/setup-go-private
with:
go-version: ${{ env.GO_VERSION }}
gh-token: ${{ secrets.GIT_ACCESS_TOKEN }}
- name: Run tests
run: make test
build:
uses: ./.github/workflows/docker.yml
needs: [precheck]
with:
version: ${{ needs.precheck.outputs.tag }}
push-image: true
secrets:
GIT_ACCESS_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }}
upload-crds:
runs-on: ubuntu-24.04
needs: [precheck]
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.release.tag_name }}
- name: Setup Go with private modules
uses: ./.github/actions/setup-go-private
with:
go-version: ${{ env.GO_VERSION }}
gh-token: ${{ secrets.GIT_ACCESS_TOKEN }}
- name: Package CRDs
run: make package-crds VERSION=${{ needs.precheck.outputs.tag }}
- name: Upload CRD Assets
uses: softprops/action-gh-release@v2.3.2
with:
files: |
dist/ui-operator-crds-${{ needs.precheck.outputs.tag }}.yaml
tag_name: ${{ github.event.release.tag_name }}