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