Add new workflow updates to cookiecutter

This commit is contained in:
object-Object 2023-09-14 23:46:59 -04:00
parent 0c7664251f
commit 5c8434d68e
2 changed files with 12 additions and 10 deletions

View file

@ -29,6 +29,10 @@ runs:
shell: bash shell: bash
run: | run: |
wheels=( _dist/*-py3-none-any.whl ) wheels=( _dist/*-py3-none-any.whl )
if [[ "$USE_TESTPYPI_INDEX" == true ]]; then
pip install "${wheels[0]}" --extra-index-url https://test.pypi.org/simple/
else
pip install "${wheels[0]}" pip install "${wheels[0]}"
fi
rm -r _dist rm -r _dist
{% endraw %} {% endraw %}

View file

@ -33,7 +33,7 @@ on:
env: env:
PYPI_PACKAGE: {% endraw %}{{ cookiecutter.__project_name }}{% raw %} PYPI_PACKAGE: {% endraw %}{{ cookiecutter.__project_name }}{% raw %}
USE_TESTPYPI_INDEX: true USE_TESTPYPI_INDEX: false
permissions: permissions:
contents: read contents: read
@ -46,11 +46,6 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
# only execute on the default branch or when invoked manually
if: |-
github.event_name == 'workflow_dispatch' ||
github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -116,7 +111,7 @@ jobs:
- name: Install docgen from source - name: Install docgen from source
run: | run: |
if [[ $USE_TESTPYPI_INDEX ]]; then if [[ "$USE_TESTPYPI_INDEX" == true ]]; then
pip install . hatch --extra-index-url https://test.pypi.org/simple/ pip install . hatch --extra-index-url https://test.pypi.org/simple/
else else
pip install . hatch pip install . hatch
@ -165,6 +160,9 @@ jobs:
name: github-pages-tmp name: github-pages-tmp
path: _site path: _site
- name: Add job summary
run: echo "Built \`${PYPI_PACKAGE}-$(hatch version)\` from \`$(git rev-parse --short "$GITHUB_SHA")\`." >> $GITHUB_STEP_SUMMARY
generate: generate:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: build needs: build
@ -252,7 +250,7 @@ jobs:
publish-pypi: publish-pypi:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: build needs: [build, deploy-pages]
if: |- if: |-
needs.build.outputs.release == 'true' && needs.build.outputs.release == 'true' &&
(github.event_name != 'workflow_dispatch' || inputs.publish == 'PyPI (release)') (github.event_name != 'workflow_dispatch' || inputs.publish == 'PyPI (release)')
@ -276,7 +274,7 @@ jobs:
publish-testpypi: publish-testpypi:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: build needs: [build, deploy-pages]
if: github.event_name == 'workflow_dispatch' && inputs.publish == 'TestPyPI' if: github.event_name == 'workflow_dispatch' && inputs.publish == 'TestPyPI'
environment: environment: