Skip to content

Commit

Permalink
break up docsite/publish actions
Browse files Browse the repository at this point in the history
  • Loading branch information
darthtrevino committed May 21, 2024
1 parent 998bc0c commit 3fe3822
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 39 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/docsite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: graspologic Docsite Build
on:
#
# When a release tag is created (e.g. v1.0.0), this workflow will be triggered. The `poetry dynamic-version` plugin will use the correct version tag.
#
release:
types: [created]
#
# On pushes to main and dev, a prerelease version will be cut for the branch. e.g. v1.0.0-pre.10+<hash>
#
push:
paths-ignore:
- '.all-contributorsrc'
- 'CONTRIBUTORS.md'
branches:
- 'main'
- 'dev'
jobs:
publish:
uses: ./.github/workflows/publish.yml
build:
uses: ./.github/workflows/build.yml
docs:
runs-on: ubuntu-latest
needs: [publish, build]
if: github.ref=='refs/heads/main' || github.ref=='refs/heads/dev'
strategy:
matrix:
python-version: ["3.10"]
poetry-version: ["1.8.2"]
permissions:
id-token: write
contents: write
steps:
- name: Download documentation artifact
uses: actions/download-artifact@v2
with:
name: documentation-site
path: docs/documentation-site
- name: Publish reference docs (dev branch)
uses: peaceiris/actions-gh-pages@v3
if: github.ref=='refs/heads/dev'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/documentation-site
destination_dir: pre-release
- name: Publish reference docs (main branch)
uses: peaceiris/actions-gh-pages@v3
if: github.ref=='refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/documentation-site
destination_dir: ${{ needs.publish.outputs.version }}
- name: Publish latest reference docs (main branch)
uses: peaceiris/actions-gh-pages@v3
if: github.ref=='refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/documentation-site
destination_dir: latest

42 changes: 3 additions & 39 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,8 @@ jobs:
run: poetry self add "poetry-dynamic-versioning[plugin]"
- name: Install dependencies
run: poetry install
- name: Create version environment variable
run: |
echo "GRASPOLOGIC_VERSION=`poetry version --short`" >> $GITHUB_ENV
echo "GRASPOLOGIC_TAG=v`poetry version --short`" >> $GITHUB_ENV
- name: Export Publication Version
run: echo "version=`poetry version --short`" >> $GITHUB_OUTPUT
- name: Build Artifacts
run: poetry build
# Note: need to set up a Trusted Publisher on PyPi
Expand All @@ -60,38 +58,4 @@ jobs:
with:
packages-dir: dist
skip-existing: true
verbose: true
- name: Download documentation artifact
uses: actions/download-artifact@v2
with:
name: documentation-site
path: docs/documentation-site
- name: Publish reference docs (dev branch)
uses: peaceiris/actions-gh-pages@v3
if: github.ref=='refs/heads/dev'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/documentation-site
destination_dir: pre-release
- name: Publish reference docs (main branch)
uses: peaceiris/actions-gh-pages@v3
if: github.ref=='refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/documentation-site
destination_dir: ${{ env.GRASPOLOGIC_VERSION }}
- name: Publish latest reference docs (main branch)
uses: peaceiris/actions-gh-pages@v3
if: github.ref=='refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/documentation-site
destination_dir: latest
- name: Create tag and GitHub release
uses: ncipollo/release-action@v1
if: github.ref=='refs/heads/main'
with:
tag: ${{ env.GRASPOLOGIC_TAG }}
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: versions_at_release.txt

verbose: true

0 comments on commit 3fe3822

Please sign in to comment.