-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(changelog): custom template for release notes (GH action)
- nice visual, badges, nice links, logo
- Loading branch information
1 parent
d073c9d
commit 19e8cec
Showing
12 changed files
with
259 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
--- | ||
# This workflow builds the Python package and stores it as an artifact for testing during development. | ||
# It only triggers when the 'PR Draft-Release' label is applied to a pull request. | ||
# The built package is NOT pushed to PyPI but is instead stored in a draft GitHub release for reviewers to test. | ||
name: Build draft release, store in GitHub repo only | ||
|
||
on: | ||
pull_request: | ||
types: [opened, edited, reopened, synchronize, labeled] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-draft-release: | ||
runs-on: ubuntu-latest | ||
if: github.event.label.name == 'PR Draft-Release' | ||
strategy: | ||
matrix: | ||
python-version: ['3.9', '3.10', '3.11', '3.12'] | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: |- | ||
python -m pip install --upgrade pip | ||
pip install build wheel setuptools_scm # Ensure both sdist and wheel are built, setuptools_scm can help with versioning | ||
- name: Create dist directory | ||
run: mkdir -p dist | ||
|
||
- name: Get version from Git tag, save to version file | ||
run: echo $(git describe --tags --abbrev=0 | sed 's/^v//') > dist/version.txt | ||
|
||
- name: Modify version for PR draft | ||
run: |- | ||
PR_NUMBER=${{ github.event.number }} | ||
VERSION=$(cat dist/version.txt) | ||
echo "${VERSION}.dev.pr${PR_NUMBER}" > dist/version.txt | ||
- name: Build package with PR suffix | ||
run: |- | ||
PR_VERSION=$(cat dist/version.txt) | ||
python -m build --wheel --sdist --outdir dist --tag ${PR_VERSION} | ||
- name: Upload builds and version file | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: python-package-${{ matrix.python-version }} | ||
path: dist/* | ||
|
||
create-draft-release: | ||
runs-on: ubuntu-latest | ||
needs: build-draft-release # This job runs after all matrix jobs complete | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Download all builds and version file | ||
uses: actions/download-artifact@v3 | ||
with: | ||
path: dist/ | ||
|
||
- name: Read version from file | ||
id: read_version | ||
run: echo "VERSION=$(cat dist/version.txt)" >> $GITHUB_ENV | ||
|
||
- name: Create release | ||
id: create_release | ||
uses: softprops/action-gh-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
body: 'v${{ env.VERSION }} - Draft release for review PR #${{ github.event.number }}' | ||
name: v${{ env.VERSION }}.dev.pr${{ github.event.number }} | ||
draft: true # Keeps the release as a draft until published | ||
prerelease: true # Marks it as a pre-release | ||
files: dist/** # Upload all collected artifacts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,8 @@ jobs: | |
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Run pre-commit | ||
uses: pre-commit/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.