-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This aligns with the current best practices for package building, testing, and deploying via Trusted Publishers.
- Loading branch information
1 parent
e36302e
commit cdc8061
Showing
6 changed files
with
127 additions
and
71 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,10 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: github-actions | ||
directory: / | ||
groups: | ||
github-actions: | ||
patterns: | ||
- "*" # Group all Actions updates into a single larger pull request | ||
schedule: | ||
interval: weekly |
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,48 @@ | ||
name: deploy | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Release version' | ||
required: true | ||
default: '1.2.3' | ||
|
||
jobs: | ||
|
||
package: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Build and Check Package | ||
uses: hynek/[email protected] | ||
|
||
deploy: | ||
needs: package | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write # For PyPI trusted publishers. | ||
contents: write # For tag. | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Download Package | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: Packages | ||
path: dist | ||
|
||
- name: Publish package to PyPI | ||
uses: pypa/[email protected] | ||
with: | ||
attestations: true | ||
|
||
- name: GitHub Release | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
gh release create v${{ github.event.inputs.version }} --target=${{ github.ref_name }} --title v${{ github.event.inputs.version }} | ||
gh pr merge ${{ github.ref_name }} --merge |
This file was deleted.
Oops, something went wrong.
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,60 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- "test-me-*" | ||
|
||
pull_request: | ||
branches: | ||
- "*" | ||
|
||
env: | ||
FORCE_COLOR: 1 | ||
|
||
# Cancel running jobs for the same workflow and branch. | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
package: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Build and Check Package | ||
uses: hynek/[email protected] | ||
|
||
test: | ||
needs: [package] | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.8", "3.9", "3.10", "3.11"] | ||
os: [ubuntu-latest, windows-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Download Package | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: Packages | ||
path: dist | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install tox | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install --upgrade tox | ||
- name: Test | ||
shell: bash | ||
run: | | ||
tox run -e py --installpkg `find dist/*.tar.gz` |
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 |
---|---|---|
@@ -1,10 +1,15 @@ | ||
Here are the steps on how to make a new release. | ||
|
||
#. Create a ``release-VERSION`` branch from ``upstream/master``. | ||
#. Create a ``release-VERSION`` branch from ``origin/master``. | ||
#. Update ``CHANGELOG.rst``. | ||
#. Push a branch with the changes. | ||
#. Wait for all builds to pass and at least one approval. | ||
#. Push a tag ``VERSION`` to ``upstream``. | ||
#. Merge the PR. | ||
#. Start the ``deploy`` workflow: | ||
|
||
.. code-block:: console | ||
gh workflow run deploy.yml -R esss/pytest-regressions --ref release-VERSION --field version=VERSION | ||
The PR will be automatically merged. | ||
|
||
After this, the package should be published directly to PyPI. After a few hours, it should be picked up by the conda-forge bot, where one of the maintainers need to merge it so the package can be published (another couple of hours after that). |
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