fix: use pure shell instead of python3 for version parsing in runner
This commit is contained in:
parent
3848162f07
commit
c208bd99c5
@ -24,16 +24,13 @@ jobs:
|
|||||||
- name: Read version
|
- name: Read version
|
||||||
id: version
|
id: version
|
||||||
run: |
|
run: |
|
||||||
python3 -c "
|
MAJOR=$(grep '"major"' version.json | sed 's/.*: *//; s/[^0-9]//g')
|
||||||
import json, sys
|
MINOR=$(grep '"minor"' version.json | sed 's/.*: *//; s/[^0-9]//g')
|
||||||
with open('version.json') as f:
|
PATCH=$(grep '"patch"' version.json | sed 's/.*: *//; s/[^0-9]//g')
|
||||||
v = json.load(f)
|
PATCH_PADDED=$(printf "%03d" "$PATCH")
|
||||||
patch_padded = f\"{v['patch']:03d}\"
|
FULL="${MAJOR}.${MINOR}.${PATCH_PADDED}"
|
||||||
full = f\"{v['major']}.{v['minor']}.{patch_padded}\"
|
echo "version=${FULL}" >> $GITHUB_OUTPUT
|
||||||
with open('$GITHUB_OUTPUT', 'a') as out:
|
echo "Current version: ${FULL}"
|
||||||
out.write(f'version={full}\n')
|
|
||||||
print(f'Current version: {full}')
|
|
||||||
"
|
|
||||||
|
|
||||||
- name: Check if deploy needed
|
- name: Check if deploy needed
|
||||||
id: check
|
id: check
|
||||||
@ -55,28 +52,25 @@ jobs:
|
|||||||
if: steps.check.outputs.skip != 'true'
|
if: steps.check.outputs.skip != 'true'
|
||||||
id: bump
|
id: bump
|
||||||
run: |
|
run: |
|
||||||
python3 -c "
|
PATCH=$(grep '"patch"' version.json | sed 's/.*: *//; s/[^0-9]//g')
|
||||||
import json
|
NEW_PATCH=$((PATCH + 1))
|
||||||
with open('version.json') as f:
|
PATCH_PADDED=$(printf "%03d" "$NEW_PATCH")
|
||||||
v = json.load(f)
|
MAJOR=$(grep '"major"' version.json | sed 's/.*: *//; s/[^0-9]//g')
|
||||||
v['patch'] += 1
|
MINOR=$(grep '"minor"' version.json | sed 's/.*: *//; s/[^0-9]//g')
|
||||||
patch_padded = f\"{v['patch']:03d}\"
|
FULL="${MAJOR}.${MINOR}.${PATCH_PADDED}"
|
||||||
full = f\"{v['major']}.{v['minor']}.{patch_padded}\"
|
|
||||||
with open('version.json', 'w') as f:
|
sed -i "s/\"patch\": ${PATCH}/\"patch\": ${NEW_PATCH}/" version.json
|
||||||
json.dump(v, f, indent=2)
|
echo "release_version=${FULL}" >> $GITHUB_OUTPUT
|
||||||
with open('$GITHUB_OUTPUT', 'a') as out:
|
echo "Bumped to ${FULL}"
|
||||||
out.write(f'release_version={full}\n')
|
|
||||||
print(f'Bumped to {full}')
|
|
||||||
"
|
|
||||||
|
|
||||||
git config user.email "bot@example.com"
|
git config user.email "bot@example.com"
|
||||||
git config user.name "CI Release Bot"
|
git config user.name "CI Release Bot"
|
||||||
git add version.json
|
git add version.json
|
||||||
git commit -m "release: bump to ${{ steps.bump.outputs.release_version }}"
|
git commit -m "release: bump to ${FULL}"
|
||||||
git push origin main
|
git push origin main
|
||||||
|
|
||||||
git tag -a "v${{ steps.bump.outputs.release_version }}" -m "release: ${{ steps.bump.outputs.release_version }}"
|
git tag -a "v${FULL}" -m "release: ${FULL}"
|
||||||
git push origin "v${{ steps.bump.outputs.release_version }}"
|
git push origin "v${FULL}"
|
||||||
|
|
||||||
- name: Login to Gitea Registry
|
- name: Login to Gitea Registry
|
||||||
if: steps.check.outputs.skip != 'true'
|
if: steps.check.outputs.skip != 'true'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user