|
| 1 | +name: Publish Usage Guide |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - main |
| 6 | + pull_request: |
| 7 | + branches: |
| 8 | + - main |
| 9 | + |
| 10 | +env: |
| 11 | + CDN: https://d3fqnyekunr9xg.cloudfront.net |
| 12 | + |
| 13 | +# By default dependabot only receives read permissions. Explicitly give it write |
| 14 | +# permissions which is needed by the ouzi-dev/commit-status-updater task. |
| 15 | +# |
| 16 | +# Updating status is relatively safe (doesnt modify source code) and caution |
| 17 | +# should be taken before adding more permissions. |
| 18 | +permissions: |
| 19 | + contents: write |
| 20 | + statuses: write |
| 21 | + |
| 22 | +jobs: |
| 23 | + build-deploy: |
| 24 | + runs-on: ubuntu-latest |
| 25 | + steps: |
| 26 | + - name: Checkout s2n-tls repo |
| 27 | + uses: actions/checkout@v4 |
| 28 | + |
| 29 | + - uses: dtolnay/rust-toolchain@stable |
| 30 | + |
| 31 | + - name: Set override |
| 32 | + run: rustup override set stable |
| 33 | + |
| 34 | + - uses: camshaft/install@v1 |
| 35 | + with: |
| 36 | + crate: mdbook |
| 37 | + |
| 38 | + - name: Build book |
| 39 | + run: | |
| 40 | + cd docs/usage-guide |
| 41 | + mdbook build |
| 42 | + |
| 43 | + - name: Deploy documentation to gh-pages |
| 44 | + |
| 45 | + if: github.event_name == 'push' |
| 46 | + with: |
| 47 | + destination_dir: usage-guide |
| 48 | + publish_dir: docs/usage-guide/book |
| 49 | + |
| 50 | + - name: Configure AWS credentials |
| 51 | + uses: aws-actions/[email protected] |
| 52 | + if: github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name |
| 53 | + with: |
| 54 | + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 55 | + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 56 | + aws-region: us-west-1 |
| 57 | + |
| 58 | + - name: Upload to S3 |
| 59 | + if: github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name |
| 60 | + id: s3 |
| 61 | + run: | |
| 62 | + TARGET="${{ github.sha }}/book" |
| 63 | + aws s3 sync docs/usage-guide/book "s3://s2n-tls-ci-artifacts/$TARGET" --acl private --follow-symlinks |
| 64 | + URL="$CDN/$TARGET/index.html" |
| 65 | + echo "URL=$URL" >> $GITHUB_OUTPUT |
| 66 | + |
| 67 | + - name: Output mdbook url |
| 68 | + |
| 69 | + if: github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name |
| 70 | + with: |
| 71 | + name: "book / url" |
| 72 | + status: "success" |
| 73 | + url: "${{ steps.s3.outputs.URL }}" |
0 commit comments