Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,18 @@ jobs:
permissions:
contents: write
steps:
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}

- uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}

- name: Set up Python
uses: actions/setup-python@v5
Expand Down Expand Up @@ -48,20 +57,22 @@ jobs:
poetry build

- name: Commit version bump
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

# Show status for debugging
git status
# Explicitly set the remote URL with the app token
git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick suggestion: If you use the repository key of the checkout step set to this string you might not need to explicitly set-url later?

- uses: actions/checkout@v6
  with:
    # Repository name with owner. For example, actions/checkout
    # Default: ${{ github.repository }}
    repository: ''

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is lifted straight from the vscode-repo, so at least this works 🤷


# Add changed files
git add pyproject.toml poetry.lock novem/version.py

# Only commit if there are changes
if ! git diff --cached --quiet; then
git commit -m "Release v$VERSION"
git push origin HEAD:main
git push origin main
else
echo "No changes to commit"
fi
Expand Down