Merge pull request #391 from fabric-testbed/rel1.8 #21
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
# Publish the package on PyPI. | |
# | |
# https://pypi.org/project/fabrictestbed-extensions/ is configured | |
# with GitHub as "trusted publisher", meaning, there is no exchange of | |
# a long-term password or token between GitHub and PyPI. See | |
# documentation here: https://docs.pypi.org/trusted-publishers/ | |
name: Publish | |
# This workflow will be triggered when a tag with prefix "rel" is | |
# pushed to the repository. | |
on: | |
push: | |
tags: | |
- "rel*" | |
jobs: | |
tests: | |
uses: ./.github/workflows/test.yml | |
pypi-publish: | |
name: Publish packages on PyPI | |
runs-on: ubuntu-latest | |
needs: | |
- tests | |
environment: | |
name: publish | |
url: https://pypi.org/p/fabrictestbed-extensions | |
# See https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs | |
permissions: | |
# This permission is mandatory for trusted publishing. | |
id-token: write | |
# This permission allows the action to create a release. | |
contents: write | |
steps: | |
- name: Check out sources | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.9" | |
cache: 'pip' | |
cache-dependency-path: pyproject.toml | |
- name: Build package | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install flit | |
python -m flit build | |
# See https://github.com/marketplace/actions/pypi-publish. | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
# GitHub CLI (aka "gh" command) is pre-installed in hosted runners. | |
# See https://docs.github.com/en/actions/using-workflows/using-github-cli-in-workflows | |
- name: Create a GitHub release | |
run: | | |
RELEASE_TAG=$GITHUB_REF_NAME | |
RELEASE_TITLE="Release $(echo "$RELEASE_TAG" | sed 's/^rel//g')" | |
echo "RELEASE_TAG=${RELEASE_TAG}, RELEASE_TITLE=${RELEASE_TITLE}" | |
gh release create ${RELEASE_TAG} --title="${RELEASE_TITLE}" --generate-notes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |