Skip to content

Commit

Permalink
take 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Morris committed Jun 28, 2024
1 parent e8cda95 commit 93029ae
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 28 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
name: bump
on:
pull_request:
types: [closed]
branches: [main]

jobs:
bump:
# make sure this job runs only when the PR is not a version bump PR and the pr is merged to main (not just closed)
if: github.event.pull_request.title != 'admin/version-bump' && github.event.pull_request.merged == true
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
contents: write # Add this permission to allow pushing the version bump
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch all history for all branches and tags

- name: Setup PDM
uses: pdm-project/setup-pdm@v2
with:
python-version: "3.10"

- name: Install bumpversion
run: pip install bumpversion

- name: Configure Git
run: |
git config user.name github-actions
git config user.email [email protected]
- name: Delete remote branch # delete the branch if it exists
run: |
git push origin --delete admin/version-bump || true
- name: Apply bumpversion minor
run: |
git checkout -b admin/version-bump
bumpversion minor
git push origin admin/version-bump
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
branch: admin/version-bump
title: admin/version-bump
body: "Automated version bump"
base: main
34 changes: 6 additions & 28 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,29 @@
---
name: publish
on:
push:
pull_request:
types: [closed]
branches: [main]

jobs:
publish:
# only publish when the PR is a version bump PR and the pr is merged to main
if: github.event.pull_request.title == 'admin/version-bump' && github.event.pull_request.merged == true
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
contents: write # Add this permission to allow pushing the version bump
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch all history for all branches and tags

- name: Setup PDM
uses: pdm-project/setup-pdm@v2
with:
python-version: "3.10"

- name: Install bumpversion
run: pip install bumpversion

- name: Configure Git
run: |
git config user.name github-actions
git config user.email [email protected]
- name: Apply bumpversion minor
run: |
git checkout -b version-bump
bumpversion minor
git push origin version-bump
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
branch: admin/version-bump
title: admin/version-bump
body: "Automated version bump"
base: main
delete-branch: true

- name: Build package
run: pdm build

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
uses: pypa/gh-action-pypi-publish@release/v1

0 comments on commit 93029ae

Please sign in to comment.