docs: map #23
This file contains hidden or 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: publish Documentation to github pages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| env: | |
| AWS_REGION: "us-west-2" | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Configure Pages | |
| uses: actions/configure-pages@v5 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.x | |
| - name: Install dependencies | |
| run: pip install zensical | |
| - name: Build documentation | |
| run: zensical build --clean | |
| - name: Upload artifact for GitHub Pages (staging) | |
| uses: actions/upload-pages-artifact@v4 | |
| with: | |
| path: site | |
| - name: Upload artifact for prod deploy | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: docs-site | |
| path: site | |
| deploy-github-pages: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| permissions: | |
| pages: write | |
| id-token: write | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| deploy-prod: | |
| needs: deploy-github-pages | |
| runs-on: ubuntu-latest | |
| environment: prod | |
| permissions: | |
| id-token: write | |
| contents: read | |
| env: | |
| TARBALL: aws-durable-execution-docs-${{ github.sha }}.tar.gz | |
| steps: | |
| - name: Download built docs | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: docs-site | |
| path: site | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 | |
| with: | |
| role-to-assume: ${{ secrets.SYNC_ROLE }} | |
| role-session-name: docssyncsession | |
| aws-region: ${{ env.AWS_REGION }} | |
| - name: Create tarball of docs | |
| run: tar -czf "${{ env.TARBALL }}" -C site . | |
| - name: Upload tarball to S3 | |
| run: aws s3 cp "${{ env.TARBALL }}" "s3://${{ secrets.S3_BUCKET_NAME }}/${{ env.TARBALL }}" | |
| - name: Invoke Lambda to sync to Gitfarm | |
| run: | | |
| aws lambda invoke \ | |
| --function-name "${{ secrets.SYNC_LAMBDA_ARN }}" \ | |
| --payload '{"gitFarmRepo":"${{ secrets.GF_REPO }}","s3FilePath":"${{ env.TARBALL }}","extractArchive":true,"gitHubRepo":"aws-durable-execution-docs","gitHubCommit":"${{ github.sha }}"}' \ | |
| --cli-binary-format raw-in-base64-out \ | |
| output.txt | |
| - name: Check Lambda response for errors | |
| run: | | |
| if grep -q "Error" output.txt; then | |
| cat output.txt | |
| exit 1 | |
| fi | |
| cat output.txt |