-
Notifications
You must be signed in to change notification settings - Fork 0
185 lines (162 loc) · 5.79 KB
/
Copy pathrelease.yml
File metadata and controls
185 lines (162 loc) · 5.79 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
name: Release
on:
workflow_dispatch:
inputs:
version_type:
description: 'Version bump type'
required: true
type: choice
options:
- patch
- minor
- major
pull_request:
types: [closed]
branches:
- main
env:
TARGET_KERNEL_BASE: 6.8.0
jobs:
prepare_release:
if: |
github.event_name == 'workflow_dispatch' ||
(github.event.pull_request.merged == true &&
!contains(github.event.pull_request.labels.*.name, 'not-a-release') &&
(contains(github.event.pull_request.labels.*.name, 'release:major') ||
contains(github.event.pull_request.labels.*.name, 'release:minor') ||
contains(github.event.pull_request.labels.*.name, 'release:patch')))
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: read
outputs:
release_tag: ${{ steps.new_version.outputs.tag }}
release_version: ${{ steps.new_version.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Validate release labels
if: github.event_name == 'pull_request'
env:
RELEASE_MAJOR: ${{ contains(github.event.pull_request.labels.*.name, 'release:major') }}
RELEASE_MINOR: ${{ contains(github.event.pull_request.labels.*.name, 'release:minor') }}
RELEASE_PATCH: ${{ contains(github.event.pull_request.labels.*.name, 'release:patch') }}
run: |
bash .github/scripts/release/validate-release-labels.sh
- name: Determine version bump type
id: version_type
env:
EVENT_NAME: ${{ github.event_name }}
INPUT_VERSION_TYPE: ${{ inputs.version_type }}
RELEASE_MAJOR: ${{ contains(github.event.pull_request.labels.*.name, 'release:major') }}
RELEASE_MINOR: ${{ contains(github.event.pull_request.labels.*.name, 'release:minor') }}
RELEASE_PATCH: ${{ contains(github.event.pull_request.labels.*.name, 'release:patch') }}
run: |
bash .github/scripts/release/determine-version-type.sh
- name: Get current version
id: current_version
run: |
bash .github/scripts/release/get-current-version.sh
- name: Calculate new version
id: new_version
env:
CURRENT_VERSION: ${{ steps.current_version.outputs.version }}
VERSION_TYPE: ${{ steps.version_type.outputs.type }}
run: |
bash .github/scripts/release/calculate-new-version.sh
- name: Create release notes
env:
VERSION: ${{ steps.new_version.outputs.version }}
BUMP_TYPE: ${{ steps.version_type.outputs.type }}
EVENT_NAME: ${{ github.event_name }}
run: |
bash .github/scripts/release/create-release-notes.sh
- name: Upload release metadata
uses: actions/upload-artifact@v4
with:
name: release-metadata
path: /tmp/release_notes.md
if-no-files-found: error
build_binaries:
needs: prepare_release
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
runner: ubuntu-24.04
- arch: arm64
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential linux-headers-generic
- name: Build binaries for target kernel
env:
TARGET_ARCH: ${{ matrix.arch }}
RELEASE_TAG: ${{ needs.prepare_release.outputs.release_tag }}
run: |
bash .github/scripts/release/build-target-binaries.sh
- name: Upload architecture binaries
uses: actions/upload-artifact@v4
with:
name: binaries-${{ matrix.arch }}
path: out/${{ matrix.arch }}/*
if-no-files-found: error
publish_release:
needs:
- prepare_release
- build_binaries
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: dist/artifacts
- name: Create bundled binary package
id: package
env:
RELEASE_TAG: ${{ needs.prepare_release.outputs.release_tag }}
RELEASE_VERSION: ${{ needs.prepare_release.outputs.release_version }}
run: |
bash .github/scripts/release/create-bundle-package.sh
- name: Create and push tag
env:
TAG: ${{ needs.prepare_release.outputs.release_tag }}
run: |
bash .github/scripts/release/create-and-push-tag.sh
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.prepare_release.outputs.release_tag }}
name: Release ${{ needs.prepare_release.outputs.release_tag }}
body_path: dist/artifacts/release-metadata/release_notes.md
files: |
${{ steps.package.outputs.archive_path }}
${{ steps.package.outputs.checksum_path }}
draft: false
prerelease: false