Skip to content

Bump version from 2.4.2 to 2.4.3 #12

Bump version from 2.4.2 to 2.4.3

Bump version from 2.4.2 to 2.4.3 #12

name: Create Release from main
on:
push:
branches:
- main
permissions:
contents: write # needed to create releases
jobs:
release:
runs-on: ubuntu-latest
steps:
# 1️⃣ Checkout the repository
- name: Checkout repository
uses: actions/checkout@v4
# 2️⃣ Extract version from PBS_Chunk_Checker.py
- name: Read version from PBS_Chunk_Checker.py
id: version
run: |
VERSION=$(grep '__version__' PBS_Chunk_Checker.py | head -n1 | sed -E 's/.*"([^"]+)".*/\1/')
if [ -z "$VERSION" ]; then
echo "❌ Version not found in PBS_Chunk_Checker.py"
exit 1
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Detected version: $VERSION"
# 3️⃣ Check if release for this version already exists
- name: Check if release exists
id: check_release
run: |
VERSION=${{ steps.version.outputs.version }}
EXISTING=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/releases/tags/v${VERSION} \
| jq -r '.id // empty')
if [ -n "$EXISTING" ]; then
echo "exists=true" >> $GITHUB_OUTPUT
echo "✅ Release for v${VERSION} already exists."
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "ℹ️ No release found for v${VERSION}, continuing..."
fi
# 4️⃣ Stop if release already exists
- name: Stop if release already exists
if: steps.check_release.outputs.exists == 'true'
run: echo "Release already exists, skipping." && exit 0
# 5️⃣ (Optional) Rename file to include version for clarity
- name: Copy versioned script
if: steps.check_release.outputs.exists == 'false'
run: |
cp PBS_Chunk_Checker.py PBS_Chunk_Checker_v${{ steps.version.outputs.version }}.py
# 6️⃣ Create GitHub Release
- name: Create GitHub Release
if: steps.check_release.outputs.exists == 'false'
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.version.outputs.version }}
name: "PBS_Chunk_Checker v${{ steps.version.outputs.version }}"
body: |
🚀 Automated release from main branch
Version: v${{ steps.version.outputs.version }}
Commit: ${{ github.sha }}
files: PBS_Chunk_Checker_v${{ steps.version.outputs.version }}.py