Replace Jenkinsfile with GitHub Actions CI, release and lint tooling

This commit is contained in:
2026-10-20 20:47:44 +00:00
parent 222877a847
commit 74f0a2f5ab
15 changed files with 337 additions and 122 deletions
+75
View File
@@ -0,0 +1,75 @@
# The golangci-lint version lives in hack/golangci-lint.version, which Dependabot
# cannot parse. This bumps it and opens a PR.
#
# Events caused by GITHUB_TOKEN start no workflows. AUTOMATION_SSH_KEY is an optional
# repository secret holding the private half of a deploy key with write access; the
# branch is pushed over SSH with it, so pushes to an open PR run ci.yaml. Opening the PR
# is still a GITHUB_TOKEN event, so a new PR gets its checks from a dispatched run on
# its branch, as workflow_dispatch is the exception to that rule.
name: upstream-sync
on:
schedule:
- cron: "17 4 * * *"
workflow_dispatch:
permissions:
contents: write
pull-requests: write
actions: write
jobs:
golangci-lint:
runs-on: ubuntu-latest
concurrency:
group: upstream-sync-golangci-lint
cancel-in-progress: true
steps:
- uses: actions/checkout@v7
with:
ssh-key: ${{ secrets.AUTOMATION_SSH_KEY }}
- id: detect
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
current=$(cat hack/golangci-lint.version)
latest=$(gh release view --repo golangci/golangci-lint --json tagName -q .tagName)
echo "current=${current}" >> "$GITHUB_OUTPUT"
echo "latest=${latest}" >> "$GITHUB_OUTPUT"
[ "${current}" = "${latest}" ] && echo "changed=false" >> "$GITHUB_OUTPUT" || echo "changed=true" >> "$GITHUB_OUTPUT"
- if: steps.detect.outputs.changed == 'true'
run: echo "${{ steps.detect.outputs.latest }}" > hack/golangci-lint.version
# A new release usually means new checks, so let the PR say whether we pass.
- if: steps.detect.outputs.changed == 'true'
id: lint
continue-on-error: true
uses: golangci/golangci-lint-action@v9
with:
version: ${{ steps.detect.outputs.latest }}
- if: steps.detect.outputs.changed == 'true'
id: pr
uses: peter-evans/create-pull-request@v8
with:
branch: automation/golangci-lint-version-sync
delete-branch: true
commit-message: "Bump golangci-lint to ${{ steps.detect.outputs.latest }}"
title: "Bump golangci-lint to ${{ steps.detect.outputs.latest }}"
body: |
Automated golangci-lint upstream sync.
- Previous: `${{ steps.detect.outputs.current }}`
- New: `${{ steps.detect.outputs.latest }}`
Result of running the new version against the tree: `${{ steps.lint.outcome }}`.
A failure here is expected when a release adds checks; the findings are in the
job log of the run that opened this PR.
- if: steps.pr.outputs.pull-request-operation == 'created'
env:
GH_TOKEN: ${{ github.token }}
run: gh workflow run ci.yaml --ref automation/golangci-lint-version-sync