Skip to content

Commit

Permalink
Use new manual deployment workflow (#42)
Browse files Browse the repository at this point in the history
As well as creating the package only once and test on all platforms.
  • Loading branch information
nicoddemus authored May 22, 2023
1 parent a6eaa34 commit cae8d6c
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 19 deletions.
23 changes: 16 additions & 7 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@ on:

jobs:

deploy:
package:
runs-on: ubuntu-latest
environment: deploy
permissions:
id-token: write # For PyPI trusted publishers.
contents: write # For tag and release notes.
env:
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ github.event.inputs.version }}

Expand All @@ -25,6 +21,17 @@ jobs:
- name: Build and Check Package
uses: hynek/build-and-inspect-python-package@v1.5

deploy:
needs: package
runs-on: ubuntu-latest
environment: deploy
permissions:
id-token: write # For PyPI trusted publishers.
contents: write # For tag.

steps:
- uses: actions/checkout@v3

- name: Download Package
uses: actions/download-artifact@v3
with:
Expand All @@ -36,5 +43,7 @@ jobs:

- name: Push tag
run: |
git tag ${{ github.event.inputs.version }} ${{ github.sha }}
git push origin ${{ github.event.inputs.version }}
git config user.name "pytest bot"
git config user.email "pytestbot@gmail.com"
git tag --annotate --message=v${{ github.event.inputs.version }} v${{ github.event.inputs.version }} ${{ github.sha }}
git push origin v${{ github.event.inputs.version }}
39 changes: 29 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
name: test

on: [push, pull_request]
on:
push:
branches:
- master
- "test-me-*"

pull_request:
branches:
- "*"

# 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@v3
- name: Build and Check Package
uses: hynek/build-and-inspect-python-package@v1.5

test:
needs: [package]

runs-on: ${{ matrix.os }}

Expand All @@ -31,21 +47,24 @@ jobs:

steps:
- uses: actions/checkout@v3

- name: Download Package
uses: actions/download-artifact@v3
with:
name: Packages
path: dist

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: Install tox
run: |
python -m pip install --upgrade pip
pip install --upgrade virtualenv tox
pip install tox
- name: Test
shell: bash
run: |
tox -e ${{ matrix.tox_env }}
check-package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build and Check Package
uses: hynek/build-and-inspect-python-package@v1.5
tox run -e ${{ matrix.tox_env }} --installpkg `find dist/*.tar.gz`
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,6 @@ venv.bak/
.mypy_cache/

src/pytest_reportlog/_version.py

# PyCharm
.idea/
4 changes: 2 additions & 2 deletions RELEASING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ Here are the steps on how to make a new release.

1. Create a ``release-VERSION`` branch from ``upstream/main``.
2. Update ``CHANGELOG.rst``.
3. Push the branch to ``upstream``.
4. Once all tests pass, start the ``deploy`` workflow manually.
3. Push the branch to ``upstream`` and open a PR.
4. Once all tests pass, start the ``deploy`` workflow manually from the branch ``release-VERSION``, passing ``VERSION`` as parameter.
5. Merge the PR.

0 comments on commit cae8d6c

Please sign in to comment.