v1.0.3 #55
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: Python Release Build | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ main ] | |
tags: | |
- 'v*' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: extractions/setup-just@v1 | |
- name: Install poetry | |
run: pipx install poetry | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
cache: 'poetry' | |
- run: poetry install | |
- name: set version | |
shell: bash | |
run: | | |
pyproject="$(cat pyproject.toml)" | |
version="${{ github.ref }}" | |
if [[ "$version" = "refs/heads/main" ]]; then | |
version="0.0.0-dev" | |
else | |
version="${version/refs\/tags\/v/}" | |
fi | |
<<<"$pyproject" >pyproject.toml sed -e 's/^version = "0.0.0.replaced-by-ci"/version = "'"$version"'"/g' | |
- name: Run Python docs | |
run: | | |
just docs | |
- name: Upload docs artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: docs | |
path: docs/_build | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: extractions/setup-just@v1 | |
- name: Install poetry | |
run: pipx install poetry | |
- name: set version | |
shell: bash | |
run: | | |
pyproject="$(cat pyproject.toml)" | |
version="${{ github.ref }}" | |
if [[ "$version" = "refs/heads/main" ]]; then | |
version="0.0.0-dev" | |
else | |
version="${version/refs\/tags\/v/}" | |
fi | |
<<<"$pyproject" >pyproject.toml sed -e 's/^version = "0.0.0.replaced-by-ci"/version = "'"$version"'"/g' | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
cache: 'poetry' | |
- run: poetry install | |
- name: build releases | |
run: | | |
just build | |
- name: upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: dist/* | |
release: | |
needs: [docs, build] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
- uses: actions/download-artifact@v3 | |
with: | |
name: docs | |
path: docs | |
- run: | | |
tar zcvf docs.tar.gz docs --strip-components 1 | |
- name: Upload Artifact to Draft Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: true | |
files: | | |
docs | |
dist/* | |
if: startsWith(github.ref, 'refs/tags/') | |
- uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "latest" | |
prerelease: true | |
title: "Development Build" | |
files: | | |
docs.tar.gz | |
dist/* | |
if: github.ref == 'refs/heads/main' |