release #30
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
# Whenever we have a prerelease, we want to: | |
# * Build the sdist and attach it to the release. | |
# * Ensure that the docs will build. | |
# This should be triggered from the cmdline with `just prerelease`. | |
# Could also be triggered from the release page. | |
name: release | |
on: | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
# test-code: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - uses: actions/setup-python@v4 | |
# with: | |
# python-version: "3.10" | |
# cache: pip | |
# - run: python -m pip install ".[dev]" | |
# - run: pytest ${{ env.test-dir }} | |
# test-docs: | |
# needs: [test-code] | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - uses: actions/setup-python@v4 | |
# with: | |
# python-version: "3.10" | |
# cache: pip | |
# - run: python -m pip install ".[dev]" | |
# - run: mkdocs build --clean --strict | |
# Need to ensure we bump before we create any artifacts | |
bump: | |
runs-on: ubuntu-latest | |
#needs: [test-code, test-docs] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-tags: 1 # Essential to later commitizen | |
fetch-depth: 0 # Reccommended by the action | |
token: ${{ secrets.PUSH_ACCESS }} | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
cache: pip | |
- run: git tag # Debug statement | |
- name: Create bump and changelog | |
uses: commitizen-tools/commitizen-action@master | |
id: cz | |
with: | |
github_token: ${{ secrets.PUSH_ACCESS }} | |
debug: true | |
build: | |
needs: [bump] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
cache: pip | |
- run: python -m pip install build | |
- run: python -m build --sdist | |
- name: Store the distribution packages | |
uses: actions/upload-artifact@v3 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
docs: | |
needs: [bump] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
cache: pip | |
- run: python -m pip install ".[dev]" | |
- name: "Build and Deploy Docs" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
current_version=$(git tag | sort --version-sort | tail -n 1) | |
mike deploy \ | |
--push \ | |
--title "${current_version} (latest)" \ | |
--update-aliases \ | |
"${current_version}" \ | |
"latest" | |
release: | |
needs: [docs, build] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-tags: 1 | |
fetch-depth: 0 | |
- uses: actions/download-artifact@v3 | |
with: | |
path: dist/ | |
- run: ls -R dist | |
- name: "Create Github Release" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
current_version=$(git tag | sort --version-sort | tail -n 1) | |
gh release create \ | |
--generate-notes \ | |
--prerelease \ | |
--verify-tag \ | |
"${current_version}" "dist/amltk-${current_version}.tar.gz" | |
publish: | |
needs: [release] | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
path: dist/ | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |