48 lines
1.4 KiB
YAML
48 lines
1.4 KiB
YAML
name: Pat Bump Tag
|
|
|
|
on:
|
|
pull_request:
|
|
types:
|
|
- closed
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build:
|
|
# Accessing the context for Github
|
|
if: ${{ github.event.pull_request.merged == true }}
|
|
runs-on: ubuntu-latest
|
|
# On GitHub this grants tag push; on Gitea it's ignored, but harmless.
|
|
permissions:
|
|
contents: write
|
|
|
|
steps:
|
|
- name: Checkout main (not the merge SHA)
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: main # create a local 'main'
|
|
fetch-depth: 0
|
|
token: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
- name: Ensure local 'main' tracks origin/main (for Gitea runners)
|
|
run: |
|
|
# make sure we have everything
|
|
git fetch origin main --tags --prune
|
|
# be on main (no-op if already there)
|
|
git checkout main || git switch main
|
|
# hard update the working tree to match origin/main
|
|
git reset --hard origin/main
|
|
# ensure upstream is set (harmless if already set)
|
|
git branch --set-upstream-to=origin/main main
|
|
git config user.name "hangpersonal"
|
|
git config user.email "hangcui1201@gmail.com"
|
|
|
|
- name: Bump version and push tag
|
|
uses: anothrNick/github-tag-action@1.64.0
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
|
WITH_V: true
|
|
DEFAULT_BUMP: minor
|
|
DEFAULT_BRANCH: main
|
|
RELEASE_BRANCHES: main
|
|
TAG_CONTEXT: repo |