Skip to content

Commit

Permalink
Merge pull request #10 from sachahu1/ci/fix-pipeline
Browse files Browse the repository at this point in the history
fix: pipeline build and release docs at the tag node
  • Loading branch information
sachahu1 authored Aug 7, 2024
2 parents 0a1b1b7 + e56d111 commit bf6c44a
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 52 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/build-and-release-docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Release

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+'

env:
AWS_REGION: eu-west-2
AWS_OIDC_ROLE_ARN: arn:aws:iam::980416368045:role/GitHubAction-AssumeRoleWithAction
DOCS_UPLOAD_URI: s3://sachahu.com/docs/diffusion-model-framework

jobs:

build-release-docs:
runs-on: ubuntu-latest
needs:
- release
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: "^3.9.0"
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
run: poetry install --only documentation

- name: configure aws credentials
uses: aws-actions/[email protected]
with:
role-to-assume: ${{ env.AWS_OIDC_ROLE_ARN }}
role-session-name: GitHub_to_AWS_via_FederatedOIDC
aws-region: ${{ env.AWS_REGION }}
- name: Build and Deploy docs
run: |
poetry run sphinx-build -M html docs/source/ docs/build
aws s3 sync docs/build/html ${{ env.DOCS_UPLOAD_URI }}/pages/v$(poetry version --short) --delete
aws s3 sync docs/build/html ${{ env.DOCS_UPLOAD_URI }}/latest --delete
rm -rf docs/build
52 changes: 0 additions & 52 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ on:
- main
- dev

env:
AWS_REGION: eu-west-2
AWS_OIDC_ROLE_ARN: arn:aws:iam::980416368045:role/GitHubAction-AssumeRoleWithAction
DOCS_UPLOAD_URI: s3://sachahu.com/docs/diffusion-model-framework

jobs:
release:
name: Release pushed tag
Expand Down Expand Up @@ -68,50 +63,3 @@ jobs:
path: ./dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

build-release-docs:
runs-on: ubuntu-latest
needs:
- release
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: "^3.9.0"
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
run: poetry install --only documentation

- name: configure aws credentials
uses: aws-actions/[email protected]
with:
role-to-assume: ${{ env.AWS_OIDC_ROLE_ARN }}
role-session-name: GitHub_to_AWS_via_FederatedOIDC
aws-region: ${{ env.AWS_REGION }}
- name: Build and Deploy docs
run: |
poetry run sphinx-build -M html docs/source/ docs/build
aws s3 sync docs/build/html ${{ env.DOCS_UPLOAD_URI }}/pages/v$(poetry version --short) --delete
aws s3 sync docs/build/html ${{ env.DOCS_UPLOAD_URI }}/latest --delete
rm -rf docs/build

0 comments on commit bf6c44a

Please sign in to comment.