Skip to content
Merged
Show file tree
Hide file tree
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
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Bug Report or Feature Request
about: Report a bug or suggest a new feature!
title: ""
labels: ""
assignees: ""
---

### Problem

<!--
For a bug report, please copy and paste any error messages from the application or command-line here.
For a feature request, please state how the new functionality could benefit the community.
-->

### Proposed solution
46 changes: 46 additions & 0 deletions .github/ISSUE_TEMPLATE/release_checklist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: Release
about: Checklist and communication channel for PyPI and GitHub release
title: "Ready for <version-number> PyPI/GitHub release"
labels: "release"
assignees: ""
---

### PyPI/GitHub rc-release preparation checklist:

- [ ] All PRs/issues attached to the release are merged.
- [ ] All the badges on the README are passing.
- [ ] License information is verified as correct. If you are unsure, please comment below.
- [ ] Locally rendered documentation contains all appropriate pages, including API references (check no modules are
missing), tutorials, and other human-written text is up-to-date with any changes in the code.
- [ ] Installation instructions in the README, documentation, and the website are updated.
- [ ] Successfully run any tutorial examples or do functional testing with the latest Python version.
- [ ] Grammar and writing quality are checked (no typos).
- [ ] Install `pip install build twine`, run `python -m build` and `twine check dist/*` to ensure that the package can be built and is correctly formatted for PyPI release.

Please tag the maintainer (e.g., @username) in the comment here when you are ready for the PyPI/GitHub release. Include any additional comments necessary, such as version information and details about the pre-release here:

### PyPI/GitHub full-release preparation checklist:

- [ ] Create a new conda environment and install the rc from PyPI (`pip install <package-name>==??`)
- [ ] License information on PyPI is correct.
- [ ] Docs are deployed successfully to `https://<github-username-or-orgname>/<package-name>`.
- [ ] Successfully run all tests, tutorial examples or do functional testing.

Please let the maintainer know that all checks are done and the package is ready for full release.

### conda-forge release preparation checklist:

<!-- After the maintainer releases the PyPI package, please check the following when creating a PR for conda-forge release.-->

- [ ] Ensure that the full release has appeared on PyPI successfully.
- [ ] New package dependencies listed in `conda.txt` and `tests.txt` are added to `meta.yaml` in the feedstock.
- [ ] Close any open issues on the feedstock. Reach out to the maintainer if you have questions.
- [ ] Tag the maintainer for conda-forge release.

### Post-release checklist

<!-- Before closing this issue, please complete the following: -->

- [ ] Run tutorial examples and conduct functional testing using the installation guide in the README. Attach screenshots/results as comments.
- [ ] Documentation (README, tutorials, API references, and websites) is deployed without broken links or missing figures.
15 changes: 15 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
### What problem does this PR address?

<!-- Provide a brief overview and link to the issue. Attach outputs, including screenshots (before/after), if helpful for the reviewer. -->

### What should the reviewer(s) do?

<!-- Merge the code, provide feedback, initiate a discussion, etc. -->

<!--
Use the following checklist items when applicable (select only what applies):
- [ ] This PR introduces a public-facing change (e.g., figures, CLI input/output, API).
- [ ] Documentation (e.g., tutorials, examples, README) has been updated.
- [ ] A tracking issue or plan to update documentation exists.
- [ ] This PR affects internal functionality only (no user-facing change).
-->
163 changes: 163 additions & 0 deletions .github/workflows/build-wheel-release-upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
name: Release on GitHub
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Since this is a private package that we are not releasing on PyPI/CF, I just copied the build-wheel file from pdfgetx but with some minor modifications. Let me know if you want any of this changed.


on:
workflow_call:
secrets:
PAT_TOKEN:
description: "GitHub Personal Access Token"
required: true

env:
TAG: ${{ github.ref_name }}

defaults:
run:
shell: bash {0}

jobs:
prepare-release:
if: ${{ ! contains(github.ref, 'rc') }}
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
ref: main

- name: Update CHANGELOG
run: |
wget https://raw.githubusercontent.com/scikit-package/release-scripts/v0/.github/workflows/update-changelog.py
python update-changelog.py "$TAG"
rm update-changelog.py

- name: Commit updated CHANGELOG.rst
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
if ! git diff --cached --quiet; then
git commit -m "update changelog for $TAG"
git push origin main
else
echo "No CHANGELOG.rst changes"
fi

- name: New tag
run: |
git fetch --tags
git tag -d "$TAG" 2>/dev/null || true
git push origin ":$TAG" 2>/dev/null || true
git tag "$TAG"
git push origin "$TAG"

- name: Get CHANGELOG.txt
run: |
wget https://raw.githubusercontent.com/scikit-package/release-scripts/v0/.github/workflows/get-latest-changelog.py
python get-latest-changelog.py "$TAG"
rm get-latest-changelog.py

- name: Upload changelog.txt
uses: actions/upload-artifact@v4
with:
name: changelog
path: CHANGELOG.txt

release:
needs: [prepare-release]
if: always()
runs-on: ubuntu-latest
env:
REPO_FULL: ${{ github.repository }}
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
steps:
- name: Check prepare release
run: |
if [[ ${{ needs.prepare-release.result }} != 'success' && "$TAG" != *rc* ]]; then
echo "::error::Skipping release job because prepare-release failed"
exit 78
fi
echo "Continuing with release job"

- name: Download built wheels
uses: actions/download-artifact@v4
with:
path: dist/

- name: Download changelog
if: ${{ needs.prepare-release.result == 'success' }}
uses: actions/download-artifact@v4
with:
name: changelog
path: .

- name: Download instructions
uses: actions/download-artifact@v4
with:
name: instructions
path: .

- name: Zip wheels and instructions into dist/srxconfutils-$TAG-wheels.zip
run: |
mkdir -p dist
find dist -type f -name '*.whl' | zip -j dist/srxconfutils-"$TAG"-wheels.zip -@
zip -j dist/srxconfutils-"$TAG"-wheels.zip INSTRUCTIONS.txt

- name: Prepare release metadata
id: meta
run: |
if [[ "$TAG" == *rc* ]]; then
PRERELEASE=true
TITLE="Pre-release $TAG"
BODY_RAW="Changelog: https://github.com/$REPO_FULL/commits/$TAG"
else
PRERELEASE=false
TITLE="Release $TAG"
BODY_RAW=$(<CHANGELOG.txt)
fi

jq -n \
--arg tag "$TAG" \
--arg name "$TITLE" \
--arg body "$BODY_RAW" \
--argjson prerelease "$PRERELEASE" \
'{ tag_name: $tag,
name: $name,
body: $body,
prerelease: $prerelease
}' > payload.json

echo "Release metadata:"
cat payload.json

- name: Create GitHub Release
id: create_release
run: |
set -euo pipefail

HTTP_STATUS=$(
curl --silent --output resp.json --write-out "%{http_code}" \
-X POST "https://api.github.com/repos/$REPO_FULL/releases" \
-H "Accept: application/vnd.github+json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $PAT_TOKEN" \
--data @payload.json
)
if [[ "$HTTP_STATUS" -ne 201 ]]; then
echo "::error::Failed to create release (status $HTTP_STATUS)"
exit 1
fi

UPLOAD_URL=$(jq -r .upload_url resp.json | sed 's/{.*}//')
echo "upload_url=$UPLOAD_URL" >> $GITHUB_OUTPUT

- name: Upload srxconfutils-$TAG-wheels.zip
if: steps.create_release.outputs.upload_url != ''
run: |
FILE=dist/srxconfutils-$TAG-wheels.zip
echo "Uploading asset: $FILE"
curl --silent --fail --data-binary @"$FILE" \
-H "Content-Type: application/zip" \
-H "Authorization: Bearer $PAT_TOKEN" \
"${{ steps.create_release.outputs.upload_url }}?name=$(basename "$FILE")"
12 changes: 12 additions & 0 deletions .github/workflows/check-news-item.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Check for News

on:
pull_request_target:
branches:
- main

jobs:
check-news-item:
uses: scikit-package/release-scripts/.github/workflows/_check-news-item.yml@v0
with:
project: diffpy.srxconfutils
19 changes: 19 additions & 0 deletions .github/workflows/matrix-and-codecov-on-merge-to-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: CI

on:
push:
branches:
- main
release:
types:
- prereleased
- published
workflow_dispatch:

jobs:
matrix-coverage:
uses: scikit-package/release-scripts/.github/workflows/_matrix-no-codecov-on-merge-to-main.yml@v0
with:
project: diffpy.srxconfutils
c_extension: false
headless: false
Loading