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

ci: use a trusted publisher token for publishing to PyPI #1061

Merged
merged 9 commits into from
Jan 16, 2024
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
build-n-publish:
name: Build and Publish to PyPI
runs-on: ubuntu-latest
permissions:
id-token: write
needs: [framework-tests, observability-charm-tests, hello-charm-tests]
steps:
- uses: actions/checkout@v3
Expand All @@ -25,5 +27,3 @@ jobs:
run: python -m build
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
30 changes: 30 additions & 0 deletions .github/workflows/test-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Test Publish
on: [workflow_dispatch, workflow_call]

jobs:
framework-tests:
uses: ./.github/workflows/framework-tests.yaml
observability-charm-tests:
uses: ./.github/workflows/observability-charm-tests.yaml
hello-charm-tests:
uses: ./.github/workflows/hello-charm-tests.yaml
build-n-publish:
name: Build and Publish to Test PyPI
runs-on: ubuntu-latest
permissions:
id-token: write
needs: [framework-tests, observability-charm-tests, hello-charm-tests]
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: "3.10"
- name: Install wheel
run: pip install wheel
- name: Build
run: python setup.py sdist bdist_wheel
- name: Publish to test.pypi.org
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
Loading