Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge test publishing job #241

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 12 additions & 31 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,40 +97,10 @@ jobs:
name: artifact-source-dist
path: "./**/dist/*.tar.gz"

test-publish:
name: Test PyPI Publishing
runs-on: ubuntu-latest
needs: [test, make-wheels, make-sdist]
# only run jobs if the feature branch is the base repo (not in a fork)
# TODO separate step, fails PRs from forks due to: "missing or insufficient OIDC token permissions,
# the ACTIONS_ID_TOKEN_REQUEST_TOKEN environment variable was unset"
if: github.repository == 'jannikmi/timezonefinder'
permissions:
id-token: write
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4

- name: Copy artifacts to dist/ folder
run: |
find . -name 'artifact-*' -exec unzip '{}' \;
mkdir -p dist/
find . -name '*.tar.gz' -exec mv '{}' dist/ \;
find . -name '*.whl' -exec mv '{}' dist/ \;
ls -lR dist/

- name: Test PyPI Publishing
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_DEPLOYMENT_API_KEY }}
repository-url: https://test.pypi.org/legacy/
skip-existing: true

publish:
runs-on: ubuntu-latest
# Note: only run, when test publishing worked
needs: [test, make-wheels, make-sdist, test-publish]
needs: [test, make-wheels, make-sdist]
if: endsWith(github.ref, '/master')
permissions:
id-token: write
Expand Down Expand Up @@ -159,6 +129,17 @@ jobs:
find . -name '*.whl' -exec mv '{}' dist/ \;
ls -lR dist/

- name: Test PyPI Publishing
# TODO separate step to test publishing before merging to main
# NOTE: PRs from forks fail due to: "missing or insufficient OIDC token permissions,
# the ACTIONS_ID_TOKEN_REQUEST_TOKEN environment variable was unset"
# -> test publishing cannot be triggered in PRs?!
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_DEPLOYMENT_API_KEY }}
repository-url: https://test.pypi.org/legacy/
skip-existing: true

- name: Create GitHub Release
id: create_gh_release
uses: ncipollo/release-action@v1
Expand Down
Loading