Use trusted publisher mechanism to publish to Test.PyPI #1
Workflow file for this run
This file contains 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
# | |
# This source file is part of the Stanford Spezi open-source project | |
# | |
# SPDX-FileCopyrightText: 2024 Stanford University and the project authors (see CONTRIBUTORS.md) | |
# | |
# SPDX-License-Identifier: MIT | |
# | |
name: Publish Python Package | |
on: | |
push: | |
tags: | |
- '*' | |
jobs: | |
build_and_test: | |
uses: ./.github/workflows/build-and-test.yml | |
build_and_publish: | |
needs: build_and_test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install hatch toml | |
- name: Update release version | |
run: python scripts/update_version.py | |
- name: Update authors | |
run: python scripts/update_authors.py | |
- name: Build package | |
run: hatch build | |
- name: Upload release to Test PyPI | |
environment: test | |
permissions: | |
id-token: write | |
steps: | |
- name: Publish package distributions to Test PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ |