| 1 |
name: Publish Usage Guide |
| 2 |
on: |
| 3 |
push: |
| 4 |
branches: |
| 5 |
- main |
| 6 |
pull_request: |
| 7 |
branches: |
| 8 |
- main |
| 9 |
merge_group: |
| 10 |
types: [checks_requested] |
| 11 |
branches: [main] |
| 12 |
|
| 13 |
env: |
| 14 |
CDN: https://d3fqnyekunr9xg.cloudfront.net |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
permissions: |
| 22 |
contents: write |
| 23 |
statuses: write |
| 24 |
id-token: write |
| 25 |
|
| 26 |
jobs: |
| 27 |
build-deploy: |
| 28 |
runs-on: ubuntu-latest |
| 29 |
steps: |
| 30 |
- name: Checkout s2n-tls repo |
| 31 |
uses: actions/checkout@v7 |
| 32 |
|
| 33 |
- uses: dtolnay/rust-toolchain@stable |
| 34 |
|
| 35 |
- name: Set override |
| 36 |
run: rustup override set stable |
| 37 |
|
| 38 |
- uses: camshaft/install@v1 |
| 39 |
with: |
| 40 |
crate: mdbook |
| 41 |
|
| 42 |
- name: Build book |
| 43 |
run: | |
| 44 |
cd docs/usage-guide |
| 45 |
mdbook build |
| 46 |
|
| 47 |
- name: Deploy documentation to gh-pages |
| 48 |
uses: JamesIves/[email protected] |
| 49 |
if: github.event_name == 'push' |
| 50 |
with: |
| 51 |
target-folder: usage-guide |
| 52 |
folder: docs/usage-guide/book |
| 53 |
|
| 54 |
- name: Configure AWS credentials |
| 55 |
uses: aws-actions/[email protected] |
| 56 |
if: github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name |
| 57 |
with: |
| 58 |
role-to-assume: arn:aws:iam::024603541914:role/GitHubOIDCRole |
| 59 |
role-session-name: s2ntlsghauseageguidesession |
| 60 |
aws-region: us-west-2 |
| 61 |
|
| 62 |
- name: Upload to S3 |
| 63 |
if: github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name |
| 64 |
id: s3 |
| 65 |
run: | |
| 66 |
TARGET="${{ github.sha }}/book" |
| 67 |
aws s3 sync docs/usage-guide/book "s3://s2n-tls-ci-artifacts/$TARGET" --acl private --follow-symlinks |
| 68 |
URL="$CDN/$TARGET/index.html" |
| 69 |
echo "URL=$URL" >> $GITHUB_OUTPUT |
| 70 |
|
| 71 |
- name: Output mdbook url |
| 72 |
uses: ouzi-dev/commit-status-updater@v2 |
| 73 |
if: github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name |
| 74 |
with: |
| 75 |
name: "book / url" |
| 76 |
status: "success" |
| 77 |
url: "${{ steps.s3.outputs.URL }}" |