Bump the actions group across 1 directory with 5 updates (#78) #40
This file contains hidden or 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
| name: Release | |
| on: | |
| push: | |
| tags: ['v*'] | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| workflow_dispatch: | |
| permissions: {} | |
| jobs: | |
| build-pypi-distributions: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@v6 | |
| id: python-setup | |
| with: | |
| python-version: "3.x" | |
| - uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6 | |
| with: | |
| python-version: ${{ steps.python-setup.outputs.python-version }} | |
| enable-cache: false # prevent cache poisoning | |
| - name: Build PyPI distributions | |
| run: uvx --from build pyproject-build | |
| - name: Check distributions | |
| # this is done automatically when deploying to PyPI. | |
| # We only do this here for non-release builds. | |
| if: ${{ !startsWith(github.ref, 'refs/tags/v') && github.event_name != 'workflow_dispatch' }} | |
| run: uvx twine check dist/* | |
| - name: Archive distributions | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: dist | |
| path: ./dist/* | |
| build-circuit-py-bundles: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Translate Repo Name For Build Tools filename_prefix | |
| id: repo-name | |
| env: | |
| REPO_NAME: ${{ github.event.repository.name }} | |
| run: | | |
| echo repo-name=$(echo "${REPO_NAME}" | | |
| awk '{ print tolower($1) }' | | |
| tr '_' '-') >> $GITHUB_OUTPUT | |
| - name: Translate Repo Name For Build Tools package_prefix | |
| id: pkg-name | |
| env: | |
| REPO_NAME: ${{ github.event.repository.name }} | |
| run: >- | |
| echo pkg-name=$(echo "${REPO_NAME}" | | |
| awk '{ print tolower($1) }') >> "${GITHUB_OUTPUT}" | |
| - name: Checkout Current Repo | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@v6 | |
| id: python-setup | |
| with: | |
| python-version: "3.x" | |
| - uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6 | |
| with: | |
| python-version: ${{ steps.python-setup.outputs.python-version }} | |
| enable-cache: false # prevent cache poisoning | |
| - name: Install CircuitPython Linux deps | |
| run: |- | |
| sudo apt-get update | |
| sudo apt-get install libudev-dev libusb-1.0 | |
| sudo apt-get install -y gettext | |
| - name: Build assets | |
| env: | |
| FILENAME_PREFIX: ${{ steps.repo-name.outputs.repo-name }} | |
| PACKAGE_FOLDER_PREFIX: ${{ steps.pkg-name.outputs.pkg-name }} | |
| run: >- | |
| uvx --from circuitpython-build-tools | |
| circuitpython-build-bundles | |
| --filename_prefix "${FILENAME_PREFIX}" | |
| --package_folder_prefix "${PACKAGE_FOLDER_NAME}" | |
| --library_location . | |
| - name: Archive bundles | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: bundles | |
| path: ${{ github.workspace }}/bundles/ | |
| upload-release-assets: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| # needed to upload release assets | |
| contents: write | |
| needs: [build-circuit-py-bundles] | |
| steps: | |
| - name: Download bundles | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: bundles | |
| path: bundles | |
| - name: Upload Release Assets | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TAG: ${{ github.ref_name }} | |
| run: |- | |
| assets=$(ls bundles/*.zip bundles/*.json) | |
| gh release upload "${TAG}" ${assets} | |
| upload-pypi: | |
| if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| needs: [build-pypi-distributions] | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Download distributions | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: dist | |
| path: dist | |
| - name: Publish package (to ${{ !startsWith(github.ref, 'refs/tags/v') && 'Test' || '' }}PyPI) | |
| if: github.repository == 'nRF24/CircuitPython_nRF24L01' | |
| uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 | |
| with: | |
| repository-url: https://${{ startsWith(github.ref, 'refs/tags/v') && 'upload' || 'test' }}.pypi.org/legacy/ |