mirror of
https://github.com/oneclickvirt/backtrace.git
synced 2026-11-24 23:39:41 +08:00
feat(dns): prepare backtrace v0.0.21
This commit is contained in:
1 parent
e83eb23302
commit
16e551b631
15 files changed
+461
-373
No files matched your search
@@ -0,0 +1,78 @@
|
||||
name: Prepare and Tag Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release_tag:
|
||||
description: Semantic version tag; leave empty to use BackTraceVersion
|
||||
required: false
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
concurrency:
|
||||
group: backtrace-release-data
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
prepare:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
ref: main
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
- uses: actions/setup-go@v7
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
check-latest: true
|
||||
- id: release
|
||||
name: Resolve release tag
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
version="$(sed -n 's/^const BackTraceVersion = "\(v[0-9.]*\)"$/\1/p' model/model.go)"
|
||||
tag="${{ inputs.release_tag }}"
|
||||
[[ -n "$tag" ]] || tag="$version"
|
||||
[[ "$tag" == "$version" ]]
|
||||
[[ "$tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]
|
||||
git fetch --force --tags origin
|
||||
! git rev-parse --verify --quiet "refs/tags/$tag"
|
||||
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
||||
- name: Refresh embedded routing datasets
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
go run ./cmd/update-prefixes -output-dir bk/prefix
|
||||
go run ./cmd/update-asn-metadata
|
||||
- name: Validate release source
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
go mod verify
|
||||
go test -race -count=1 ./...
|
||||
go vet ./...
|
||||
go build -o "$RUNNER_TEMP/backtrace" ./cmd
|
||||
git diff --check
|
||||
- name: Commit refreshed routing datasets
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [[ -z "$(git status --porcelain -- bk/prefix bgptools/data)" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git add bk/prefix bgptools/data
|
||||
git commit -m "chore(data): refresh routing datasets"
|
||||
git push origin HEAD:main
|
||||
- name: Create immutable release tag
|
||||
env:
|
||||
RELEASE_TAG: ${{ steps.release.outputs.tag }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git tag -a "$RELEASE_TAG" -m "Release $RELEASE_TAG"
|
||||
git push origin "refs/tags/$RELEASE_TAG"
|
||||
Reference in new issue
Block a user