Skip to content

Commit

Permalink
ci: Use pypa/gh-action-pypi-publish and trusted publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathonReinhart committed Jul 10, 2023
1 parent b372c31 commit d86d142
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions .github/workflows/publish-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ on:
#branches:
# - main

# TODO: De-duplicate with build-test.yml
# TODO: De-duplicate with python-publish-release.yml

jobs:
deploy:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down Expand Up @@ -38,8 +39,32 @@ jobs:
CI_VERSION_BUILD_NUMBER: ${{ github.run_id }}
run: python setup.py sdist bdist_wheel

- name: Upload artifacts
uses: actions/uplaod-artifact@v3
with:
name: python-dist
path: dist/


pypi-publish:
name: Upload release to Test PyPI
runs-on: ubuntu-latest
environment:
name: TestPyPI
url: https://test.pypi.org/project/staticx/
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: python-dist

- name: Display downloaded files
run: ls -R

- name: Publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_TEST_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_TEST_PASSWORD }}
run: twine upload --repository-url https://test.pypi.org/legacy/ dist/*
uses: pypa/gh-action-pypi-publish@release/v1
with:
print-hash: true
repository-url: https://test.pypi.org/legacy/

0 comments on commit d86d142

Please sign in to comment.