From 986388d699454e193176ec5e245c46ccde11d0f7 Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Wed, 26 Nov 2025 18:09:04 -0800 Subject: [PATCH] chore(dev): dry-run release CI on push This removes the "Build Python package" step from the "Build CI" workflow in favor of reusing the build job in the release CI workflow. It adds triggers to the release CI for `push` and `pull_request` events that target the main branch. To be clear, publishing will only happen when a GitHub release is published (just like previous behavior). I also removed some steps in the Build CI workflow that would only make sense if experimenting with GitHub Actions. This patch uploads dists to PyPI using the trusted publisher setup in the PyPI project settings. (per https://github.com/adafruit/circuitpython-build-tools/pull/135#pullrequestreview-3536130354) --- .github/workflows/build.yml | 14 -------------- .github/workflows/release.yml | 16 ++++++++-------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 869ea7f..eaf0e95 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,17 +17,10 @@ jobs: build-and-test: runs-on: ubuntu-latest steps: - - name: Dump GitHub context - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" - name: Set up Python 3.12 uses: actions/setup-python@v6 with: python-version: "3.12" - - name: Versions - run: | - python3 --version - name: Checkout Current Repo uses: actions/checkout@v6 with: @@ -40,8 +33,6 @@ jobs: sudo apt-get install libudev-dev libusb-1.0 sudo apt-get install -y gettext pip install -r requirements.txt - - name: Library version - run: git describe --dirty --always --tags - name: Install package locally run: pip install -e . - name: Test building single package @@ -55,8 +46,3 @@ jobs: git clone --recurse-submodules https://github.com/adafruit/CircuitPython_Community_Bundle.git cd CircuitPython_Community_Bundle circuitpython-build-bundles --filename_prefix test-bundle --library_location libraries --library_depth 2 - - name: Build Python package - run: | - pip install --upgrade setuptools wheel twine readme_renderer testresources - python setup.py sdist - twine check dist/* diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 308b2ce..afe1183 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,6 +6,10 @@ name: Release Actions on: + pull_request: + branches: [main] + push: + branches: [main] release: types: [published] @@ -38,18 +42,14 @@ jobs: if: github.event_name == 'release' && startsWith(github.repository_owner, 'adafruit') needs: [build] runs-on: ubuntu-latest + permissions: + # needed for authenticating with PyPI trusted publisher + id-token: write steps: - name: Download build artifacts uses: actions/download-artifact@v6 with: name: dist path: ./dist - - name: Set up Python - uses: actions/setup-python@v6 - with: - python-version: '3.12' - name: Publish to PyPI - env: - TWINE_USERNAME: ${{ secrets.pypi_username }} - TWINE_PASSWORD: ${{ secrets.pypi_password }} - run: pipx run twine upload dist/* + uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0