Build and Publish #15
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: Build and Publish | |
on: | |
release: | |
types: [published] | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
permissions: | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
contents: write | |
pages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Install pypa/build | |
run: python -m pip install build --user | |
- name: Setup poetry | |
uses: abatilo/actions-poetry@v2.0.0 | |
with: | |
poetry-version: 1.8.3 | |
- name: Install the packages required | |
run: poetry install --with docs | |
- name: Build the package | |
run: poetry build | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ # TODO: change to https://upload.pypi.org/legacy/ after testing | |
- name: Install mike | |
run: poetry run mkdocs build | |
# https://github.com/jimporter/mike/blob/master/README.md#deploying-via-ci | |
- name: Configure git | |
run: | | |
git config user.name PsiQ-Qref | |
git config user.email qref-ci-bot@psiquantum.com | |
- name: Build docs | |
run: poetry run mike deploy $RELEASE_VERSION latest -u | |
env: | |
RELEASE_VERSION: ${{ github.ref_name }} | |
- name: Push docs | |
run: | | |
git pull -f origin gh-pages --rebase | |
git fetch origin gh-pages --depth=1 | |
git push -f origin gh-pages:gh-pages | |