|
| 1 | +name: documentation |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - main |
| 6 | + |
| 7 | +env: |
| 8 | + PYTHON_VERSION: 3.x |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: write |
| 12 | + id-token: write |
| 13 | + pages: write |
| 14 | + |
| 15 | +jobs: |
| 16 | + documentation: |
| 17 | + name: Build documentation |
| 18 | + runs-on: ubuntu-latest |
| 19 | + |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + |
| 23 | + - name: Setup python ${{ env.PYTHON_VERSION }} |
| 24 | + uses: actions/setup-python@v5 |
| 25 | + with: |
| 26 | + python-version: ${{ env.PYTHON_VERSION }} |
| 27 | + cache: pip |
| 28 | + cache-dependency-path: | |
| 29 | + requirements.txt |
| 30 | +
|
| 31 | + - name: Install dependencies |
| 32 | + run: make init |
| 33 | + |
| 34 | + - name: Build documentation |
| 35 | + run: make build |
| 36 | + |
| 37 | + - name: Configure AWS Credentials if S3 deploying is enabled |
| 38 | + # Giving this step a name so we can check later if we need to deploy to GitHub Pages instead. |
| 39 | + id: using-s3 |
| 40 | + if: ${{ env.AWS_ACCESS_KEY_ID && env.AWS_SECRET_ACCESS_KEY && env.AWS_S3_BUCKET && env.AWS_REGION }} |
| 41 | + uses: aws-actions/configure-aws-credentials@v4 |
| 42 | + with: |
| 43 | + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 44 | + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 45 | + aws-region: ${{ secrets.AWS_REGION }} |
| 46 | + env: |
| 47 | + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 48 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 49 | + AWS_REGION: ${{ secrets.AWS_REGION }} |
| 50 | + AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} |
| 51 | + |
| 52 | + - name: Push to S3 if enabled |
| 53 | + if: ${{ steps.using-s3.conclusion == 'success' }} |
| 54 | + run: aws s3 sync ./site/ s3://${{ secrets.AWS_S3_BUCKET }} --delete |
| 55 | + env: |
| 56 | + AWS_REGION: ${{ secrets.AWS_REGION }} |
| 57 | + AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} |
| 58 | + |
| 59 | + - name: Prepare GitHub Pages artifact if not deploying to S3 |
| 60 | + if: ${{ steps.using-s3.conclusion == 'skipped' }} |
| 61 | + uses: actions/upload-pages-artifact@v3 |
| 62 | + with: |
| 63 | + path: site |
| 64 | + |
| 65 | + - name: Deploy to GitHub Pages |
| 66 | + if: ${{ steps.using-s3.conclusion == 'skipped' }} |
| 67 | + continue-on-error: true |
| 68 | + uses: actions/deploy-pages@v4 |
0 commit comments