1+ name : Release
2+
3+ on :
4+ push :
5+ tags :
6+ - ' v*.*.*'
7+ env :
8+ RELEASE_VERSION : ${{ github.ref_name }}
9+ IMG : ghcr.io/openvirtualcluster/openvirtualcluster-operator:${{ github.ref_name }}
10+
11+ jobs :
12+ build-and-push :
13+ runs-on : ubuntu-latest
14+ permissions :
15+ contents : read
16+ packages : write
17+ steps :
18+ - name : Checkout code
19+ uses : actions/checkout@v3
20+
21+ - name : Set up Docker Buildx
22+ uses : docker/setup-buildx-action@v2
23+
24+ - name : Login to GitHub Container Registry
25+ uses : docker/login-action@v2
26+ with :
27+ registry : ghcr.io
28+ username : ${{ github.actor }}
29+ password : ${{ secrets.GITHUB_TOKEN }}
30+
31+ - name : Extract version
32+ id : get_version
33+ run : echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
34+
35+ - name : Build and push
36+ run : |
37+ make docker-buildx
38+ env :
39+ IMG : ${{ env.IMG }}
40+
41+ release :
42+ needs : build-and-push
43+ runs-on : ubuntu-latest
44+ permissions :
45+ contents : write
46+ steps :
47+ - name : Checkout
48+ uses : actions/checkout@v3
49+
50+ - name : Create directory for changelog config
51+ run : mkdir -p .github/workflows/changelog_builder
52+
53+ - name : Create changelog config
54+ run : |
55+ cat > .github/workflows/changelog_builder/config.json << EOF
56+ {
57+ "categories": [
58+ {
59+ "title": "## 🚀 Features",
60+ "labels": ["feature", "enhancement"]
61+ },
62+ {
63+ "title": "## 🐛 Fixes",
64+ "labels": ["fix", "bugfix", "bug"]
65+ },
66+ {
67+ "title": "## 📝 Documentation",
68+ "labels": ["documentation"]
69+ },
70+ {
71+ "title": "## 🧰 Maintenance",
72+ "labels": ["chore", "maintenance"]
73+ }
74+ ],
75+ "ignore_labels": ["ignore"],
76+ "sort": "ASC",
77+ "template": "${{CHANGELOG}}"
78+ }
79+ EOF
80+
81+ - name : " Build Changelog"
82+ id : github_release
83+ uses : mikepenz/release-changelog-builder-action@v3
84+ with :
85+ configuration : " .github/workflows/changelog_builder/config.json"
86+ env :
87+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
88+
89+ - name : Create Release
90+ uses : softprops/action-gh-release@v1
91+ with :
92+ token : ${{ secrets.GITHUB_TOKEN }}
93+ tag_name : ${{ env.RELEASE_VERSION }}
94+ name : ${{ env.RELEASE_VERSION }}
95+ body : ${{ steps.github_release.outputs.changelog }}
96+ generate_release_notes : true
97+
98+ build-installer :
99+ needs : build-and-push
100+ runs-on : ubuntu-latest
101+ steps :
102+ - name : Checkout
103+ uses : actions/checkout@v3
104+
105+ - name : Setup Go
106+ uses : actions/setup-go@v4
107+ with :
108+ go-version-file : ' go.mod'
109+
110+ - name : Build installer
111+ run : |
112+ make build-installer
113+ env :
114+ IMG : ${{ env.IMG }}
115+
116+ - name : Upload installer artifact
117+ uses : actions/upload-artifact@v3
118+ with :
119+ name : installer
120+ path : dist/install.yaml
121+
122+ - name : Upload installer to release
123+ uses : softprops/action-gh-release@v1
124+ with :
125+ token : ${{ secrets.GITHUB_TOKEN }}
126+ tag_name : ${{ env.RELEASE_VERSION }}
127+ files : dist/install.yaml
0 commit comments