Delete .forgejo/workflows/bump-version.yml
infinite loop
This commit is contained in:
parent
c49611adfe
commit
77d0588305
1 changed files with 0 additions and 77 deletions
|
|
@ -1,77 +0,0 @@
|
||||||
name: bump-version
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
env:
|
|
||||||
FORGEJO_HOST: src.sersofts.org
|
|
||||||
FORGEJO_PROTOCOL: https
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: bump-version
|
|
||||||
cancel-in-progress: false
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
bump:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
env:
|
|
||||||
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
git clone "${FORGEJO_PROTOCOL}://x-access-token:${FORGEJO_TOKEN}@${FORGEJO_HOST}/${GITHUB_REPOSITORY}.git" .
|
|
||||||
git checkout "$GITHUB_SHA"
|
|
||||||
git config user.name "forgejo-actions[bot]"
|
|
||||||
git config user.email "forgejo-actions[bot]@noreply.local"
|
|
||||||
|
|
||||||
- name: Skip if latest commit is already a release commit
|
|
||||||
run: |
|
|
||||||
SUBJECT=$(git log -1 --pretty=%s)
|
|
||||||
if [[ "$SUBJECT" == "chore(release):"* ]]; then
|
|
||||||
echo "Latest commit is a release commit ('$SUBJECT'). Skipping bump to avoid loop."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
echo "Latest commit subject: $SUBJECT — proceeding with bump."
|
|
||||||
|
|
||||||
- name: Read current version
|
|
||||||
id: current
|
|
||||||
run: |
|
|
||||||
if [[ ! -f VERSION ]]; then
|
|
||||||
echo "VERSION file missing"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
VERSION=$(tr -d '[:space:]' < VERSION)
|
|
||||||
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- name: Compute next patch version
|
|
||||||
id: next
|
|
||||||
run: |
|
|
||||||
CURRENT="${{ steps.current.outputs.version }}"
|
|
||||||
STRIP_LEADING_V='s/^v//'
|
|
||||||
CORE=$(echo "$CURRENT" | sed -E "$STRIP_LEADING_V")
|
|
||||||
BASE="${CORE%%-*}"
|
|
||||||
SUFFIX=""
|
|
||||||
if [[ "$CORE" == *-* ]]; then
|
|
||||||
SUFFIX="-${CORE#*-}"
|
|
||||||
fi
|
|
||||||
IFS='.' read -r MAJOR MINOR PATCH <<< "$BASE"
|
|
||||||
if [[ -z "$MAJOR" || -z "$MINOR" || -z "$PATCH" ]]; then
|
|
||||||
echo "Cannot parse version: $CURRENT"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
NEXT="v${MAJOR}.${MINOR}.$((PATCH + 1))${SUFFIX}"
|
|
||||||
echo "next=$NEXT" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "Bumping $CURRENT → $NEXT"
|
|
||||||
|
|
||||||
- name: Update VERSION and push bump commit
|
|
||||||
env:
|
|
||||||
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
|
||||||
run: |
|
|
||||||
NEXT="${{ steps.next.outputs.next }}"
|
|
||||||
printf '%s\n' "$NEXT" > VERSION
|
|
||||||
git add VERSION
|
|
||||||
git commit -m "chore(release): bump version to $NEXT"
|
|
||||||
git push "${FORGEJO_PROTOCOL}://x-access-token:${FORGEJO_TOKEN}@${FORGEJO_HOST}/${GITHUB_REPOSITORY}.git" HEAD:main
|
|
||||||
Loading…
Reference in a new issue