-
Notifications
You must be signed in to change notification settings - Fork 8
feat: hash-based manual release workflow #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+275
−184
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b6c9cd9
feat: hash-based manual release workflow
ValentaTomas 725cae3
fix: preserve version_name in artifact, force checkout
ValentaTomas 9274f23
fix: hash only top-level *.patch files
ValentaTomas 1e82d8d
fix: align bash kernel_versions.txt parser with python
ValentaTomas 6c08a3f
refactor: simplify to "build everything, calver release per run"
ValentaTomas 583d298
fix: calver suffix sequence base, .1, .2 (was skipping .1)
ValentaTomas 8eab674
feat: also build on pull_request, gate publish on workflow_dispatch
ValentaTomas c167397
feat: parallelize build per (kernel_version, arch)
ValentaTomas ef204f4
fix: scope id-token to publish, harden version handling, idempotent c…
ValentaTomas fd2430a
fix: emit Build kernels (x86_64|arm64) checks for branch protection
ValentaTomas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| name: Build & Release | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| pull_request: | ||
|
|
||
| permissions: | ||
|
ValentaTomas marked this conversation as resolved.
|
||
| contents: write | ||
| id-token: write | ||
|
|
||
| jobs: | ||
| matrix: | ||
| runs-on: ubuntu-24.04 | ||
| outputs: | ||
| build_matrix: ${{ steps.gen.outputs.matrix }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - id: gen | ||
| run: | | ||
| python3 - >> "$GITHUB_OUTPUT" <<'PY' | ||
| import json | ||
| versions = [] | ||
| for line in open("kernel_versions.txt").read().splitlines(): | ||
| v = line.split("#", 1)[0].strip() | ||
| if v: | ||
| versions.append(v) | ||
| include = [] | ||
| for v in versions: | ||
| include.append({"version": v, "arch": "amd64", "target_arch": "x86_64", "runner": "ubuntu-24.04"}) | ||
| include.append({"version": v, "arch": "arm64", "target_arch": "arm64", "runner": "ubuntu-24.04-arm"}) | ||
| print(f"matrix={json.dumps({'include': include})}") | ||
| PY | ||
|
|
||
| build: | ||
| needs: matrix | ||
| name: Build ${{ matrix.version }} (${{ matrix.arch }}) | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: ${{ fromJson(needs.matrix.outputs.build_matrix) }} | ||
| runs-on: ${{ matrix.runner }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Build kernel | ||
| run: sudo ./build.sh "${{ matrix.version }}" "${{ matrix.target_arch }}" | ||
|
ValentaTomas marked this conversation as resolved.
Outdated
|
||
|
|
||
| - uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: kernel-${{ matrix.version }}-${{ matrix.arch }} | ||
| path: ./builds | ||
| retention-days: 7 | ||
|
|
||
| publish: | ||
| needs: build | ||
| if: github.event_name == 'workflow_dispatch' | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - uses: actions/download-artifact@v4 | ||
| with: | ||
| path: ./builds | ||
| merge-multiple: true | ||
|
|
||
| - name: Prepare release assets | ||
| run: | | ||
| set -euo pipefail | ||
| mkdir -p release-assets | ||
| for dir in ./builds/vmlinux-*/; do | ||
| name=$(basename "$dir") | ||
| [ -f "$dir/amd64/vmlinux.bin" ] && cp "$dir/amd64/vmlinux.bin" "release-assets/${name}-amd64.bin" | ||
| [ -f "$dir/arm64/vmlinux.bin" ] && cp "$dir/arm64/vmlinux.bin" "release-assets/${name}-arm64.bin" | ||
| # Legacy non-arch-suffixed asset (= amd64) for backwards compat. | ||
| [ -f "$dir/vmlinux.bin" ] && cp "$dir/vmlinux.bin" "release-assets/${name}.bin" | ||
| done | ||
| ls -la release-assets/ | ||
|
|
||
| - name: Pick calver tag | ||
| id: tag | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| set -euo pipefail | ||
| base="$(date -u +%Y.%m.%d)" | ||
| tag="$base" | ||
| n=0 | ||
| while gh release view "$tag" >/dev/null 2>&1; do | ||
| n=$((n + 1)) | ||
| tag="${base}.${n}" | ||
| done | ||
|
ValentaTomas marked this conversation as resolved.
|
||
| echo "tag=$tag" >> "$GITHUB_OUTPUT" | ||
|
cursor[bot] marked this conversation as resolved.
|
||
|
|
||
| - name: Create release | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| set -euo pipefail | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
| git tag "${{ steps.tag.outputs.tag }}" | ||
| git push origin "${{ steps.tag.outputs.tag }}" | ||
| gh release create "${{ steps.tag.outputs.tag }}" \ | ||
| --title "Kernels ${{ steps.tag.outputs.tag }}" \ | ||
| --notes "Built from commit ${{ github.sha }} on ${{ github.ref_name }}" \ | ||
| ./release-assets/* | ||
|
|
||
| - uses: google-github-actions/auth@v2 | ||
| with: | ||
| workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} | ||
| service_account: ${{ secrets.GCP_SERVICE_ACCOUNT_EMAIL }} | ||
|
|
||
| - uses: google-github-actions/upload-cloud-storage@v2 | ||
| with: | ||
| path: ./builds | ||
| destination: ${{ vars.GCP_BUCKET_NAME }}/kernels | ||
| gzip: false | ||
| parent: false | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.