Deploy to PyPI #2
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
name: Deploy to PyPI | |
on: | |
release: | |
types: [ published, edited ] | |
jobs: | |
publish: | |
permissions: | |
# This permission is required for trusted publishing. | |
id-token: write | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Install PIP | |
run: | | |
python -m pip install --upgrade pip | |
- name: Setup Cache | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pypoetry | |
key: ${{ runner.os }}-pip- | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: | | |
python -m pip install poetry | |
python -m poetry update --lock | |
python -m poetry install | |
- name: Assert Version Correctness | |
run: | | |
TOML_VER=$(poetry version | awk -F' ' '{ print $2 }') | |
echo toml "$TOML_VER" | |
GIT_VER=${{ github.event.release.tag_name }} | |
echo git "$GIT_VER" | |
[[ "$TOML_VER" == "$GIT_VER" ]] | |
echo "__version__ = \"$GIT_VER\"" > poetry_stale_dependencies/_version.py | |
- name: Mint token | |
id: mint | |
uses: tschm/[email protected] | |
- name: Publish the package with poetry | |
run: | | |
poetry publish -u __token__ -p '${{ steps.mint.outputs.api-token }}' | |
- name: Upload Binaries as Artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: binaries | |
path: dist | |
- name: Upload Binaries to Release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: dist/* | |
tag: ${{ github.ref }} | |
overwrite: true | |
file_glob: true |