File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 types :
66 - published
77
8- permissions :
9- contents : write
8+ permissions : {}
9+
10+ concurrency :
11+ group : create-major-tag
12+ cancel-in-progress : false
1013
1114jobs :
1215 create-major-tag :
16+ permissions :
17+ contents : write
1318 runs-on : ubuntu-slim
1419 steps :
1520 - uses : actions/checkout@v6
16- - name : Get major version
21+ with :
22+ persist-credentials : false
23+
24+ - name : Validate and extract major version
25+ env :
26+ TAG : ${{ github.event.release.tag_name }}
1727 run : |
18- MAJOR_VERSION=$(echo "${GITHUB_REF#refs/tags/}" | awk -F. '{print $1}')
19- echo "MAJOR_VERSION=${MAJOR_VERSION}" >> "${GITHUB_ENV}"
28+ if [[ ! "$TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
29+ echo "::error::Tag '${TAG}' does not match expected semver format (N.N.N)"
30+ exit 1
31+ fi
32+ echo "MAJOR_VERSION=${TAG%%.*}" >> "${GITHUB_ENV}"
33+
2034 - name : Create major tag
35+ env :
36+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
2137 run : |
38+ git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
2239 git tag "v${MAJOR_VERSION}"
2340 git push -f origin "refs/tags/v${MAJOR_VERSION}"
41+ git remote set-url origin "https://github.com/${GITHUB_REPOSITORY}.git"
Original file line number Diff line number Diff line change @@ -19,13 +19,20 @@ jobs:
1919 runs-on : ubuntu-latest
2020 steps :
2121 - uses : actions/checkout@v6
22+ with :
23+ sparse-checkout : .github/release-drafter.yml
24+ persist-credentials : false
2225 - name : Wait for PR to be ready (if just opened)
2326 if : github.event_name == 'pull_request_target' && github.event.action == 'opened'
2427 run : sleep 30
2528 - id : get-labels
2629 run : |
27- labels=$(yq '[.categories[].labels] + .exclude-labels | flatten | unique | sort | @tsv' .github/release-drafter.yml | tr '\t' ',')
28- echo "labels=$labels" >> "${GITHUB_OUTPUT}"
30+ delimiter="$(openssl rand -hex 16)"
31+ {
32+ echo "labels<<${delimiter}"
33+ yq '[.categories[].labels] + .exclude-labels | flatten | unique | sort | @tsv' .github/release-drafter.yml | tr '\t' ','
34+ echo "${delimiter}"
35+ } >> "${GITHUB_OUTPUT}"
2936 - id : check-labels
3037 uses : mheap/github-action-required-labels@8afbe8ae6ab7647d0c9f0cfa7c2f939650d22509 # v5.5
3138 with :
You can’t perform that action at this time.
0 commit comments