Fix release workflow to work with repository rules
- Remove problematic direct push to main branch - Keep version updates only for release artifacts - Add pull-requests permission for future flexibility - Releases/tags created via API don't require branch pushes
This commit is contained in:
21
.github/workflows/release.yml
vendored
21
.github/workflows/release.yml
vendored
@@ -11,12 +11,14 @@ jobs:
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Get latest tag
|
- name: Get latest tag
|
||||||
id: get_tag
|
id: get_tag
|
||||||
@@ -204,7 +206,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Update version in pyproject.toml
|
- name: Update version in pyproject.toml (for release artifacts only)
|
||||||
if: steps.check_release.outputs.exists == 'false'
|
if: steps.check_release.outputs.exists == 'false'
|
||||||
run: |
|
run: |
|
||||||
# Update version in pyproject.toml (remove 'v' prefix for Python versioning)
|
# Update version in pyproject.toml (remove 'v' prefix for Python versioning)
|
||||||
@@ -213,19 +215,8 @@ jobs:
|
|||||||
|
|
||||||
if [ -f "pyproject.toml" ]; then
|
if [ -f "pyproject.toml" ]; then
|
||||||
sed -i "s/version = \".*\"/version = \"$PYTHON_VERSION\"/" pyproject.toml
|
sed -i "s/version = \".*\"/version = \"$PYTHON_VERSION\"/" pyproject.toml
|
||||||
echo "Updated pyproject.toml version to $PYTHON_VERSION"
|
echo "Updated pyproject.toml version to $PYTHON_VERSION (for release artifacts only)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Commit version update
|
# Note: No longer committing version changes back to main branch
|
||||||
if: steps.check_release.outputs.exists == 'false'
|
# The version is only updated in the release artifacts
|
||||||
run: |
|
|
||||||
git config --local user.email "action@github.com"
|
|
||||||
git config --local user.name "GitHub Action"
|
|
||||||
|
|
||||||
if git diff --quiet; then
|
|
||||||
echo "No changes to commit"
|
|
||||||
else
|
|
||||||
git add pyproject.toml
|
|
||||||
git commit -m "chore: bump version to ${{ steps.get_tag.outputs.new_version }}"
|
|
||||||
git push
|
|
||||||
fi
|
|
||||||
|
|||||||
Reference in New Issue
Block a user