-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
df61134
commit 5f00dcc
Showing
3 changed files
with
111 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
name: Python Release Build | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [ main ] | ||
tags: | ||
- 'v*' | ||
|
||
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: | ||
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 | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: docs | ||
|
||
- 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/ | ||
dist/* | ||
if: github.ref == 'refs/heads/main' |
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
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