From b588b2156fa3b98a7b9d96718b76e068b24406db Mon Sep 17 00:00:00 2001 From: Simon Thulbourn Date: Wed, 17 May 2023 12:45:36 +0200 Subject: [PATCH 1/4] feat(docs): Start S3 Docs --- .github/workflows/docs.yml | 27 +++++++++++++++++++++ .github/workflows/on_push_docs.yml | 1 + .github/workflows/reusable_publish_docs.yml | 26 +++++++++++++++++++- 3 files changed, 53 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index b95a2ea6..8b8f3057 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -5,6 +5,11 @@ on: branches: - main +permissions: + id-token: write + contents: write + pages: write + jobs: docs: # Force Github action to run only a single job at a time (based on the group name) @@ -12,6 +17,7 @@ jobs: concurrency: group: on-docs-build runs-on: ubuntu-latest + environment: Docs steps: - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c with: @@ -32,12 +38,23 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./dist + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef + with: + aws-region: us-east-1 + role-to-assume: ${{ secrets.AWS_DOCS_ROLE_ARN }} + - name: Deploy Docs + run: | + aws s3 sync \ + dist \ + s3://${{ secrets.AWS_DOCS_BUCKET }}/lambda-dotnet/ apidocs: # Force Github action to run only a single job at a time (based on the group name) # This is to prevent "race-condition" in publishing a new version of doc to `gh-pages` concurrency: group: on-docs-build runs-on: ubuntu-latest + environment: Docs steps: - uses: actions/checkout@v3 - name: Setup .NET 6.0 @@ -58,3 +75,13 @@ jobs: publish_dir: ./apidocs/_site keep_files: true destination_dir: api + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef + with: + aws-region: us-east-1 + role-to-assume: ${{ secrets.AWS_DOCS_ROLE_ARN }} + - name: Deploy Docs + run: | + aws s3 sync \ + apidocs/_site \ + s3://${{ secrets.AWS_DOCS_BUCKET }}/lambda-dotnet/api/ diff --git a/.github/workflows/on_push_docs.yml b/.github/workflows/on_push_docs.yml index d46879ca..dc064215 100644 --- a/.github/workflows/on_push_docs.yml +++ b/.github/workflows/on_push_docs.yml @@ -20,6 +20,7 @@ jobs: permissions: contents: write pages: write + id-token: write uses: ./.github/workflows/reusable_publish_docs.yml with: version: develop diff --git a/.github/workflows/reusable_publish_docs.yml b/.github/workflows/reusable_publish_docs.yml index 822ce867..d2744eaf 100644 --- a/.github/workflows/reusable_publish_docs.yml +++ b/.github/workflows/reusable_publish_docs.yml @@ -22,6 +22,7 @@ on: type: boolean permissions: + id-token: write contents: write pages: write @@ -32,6 +33,7 @@ jobs: concurrency: group: on-docs-rebuild runs-on: ubuntu-latest + environment: Docs steps: - uses: actions/checkout@v3 with: @@ -82,6 +84,17 @@ jobs: keep_files: true destination_dir: latest/api + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef + with: + aws-region: us-east-1 + role-to-assume: ${{ secrets.AWS_DOCS_ROLE_ARN }} + - name: Deploy Docs + run: | + aws s3 sync \ + dist \ + s3://${{ secrets.AWS_DOCS_BUCKET }}/lambda-dotnet/ + apidocs: # Force Github action to run only a single job at a time (based on the group name) @@ -89,6 +102,7 @@ jobs: concurrency: group: on-docs-build runs-on: macos-latest + environment: Docs steps: - uses: actions/checkout@v3 with: @@ -103,4 +117,14 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./apidocs/_site keep_files: true - destination_dir: api \ No newline at end of file + destination_dir: api + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef + with: + aws-region: us-east-1 + role-to-assume: ${{ secrets.AWS_DOCS_ROLE_ARN }} + - name: Deploy Docs + run: | + aws s3 sync \ + apidocs/_site \ + s3://${{ secrets.AWS_DOCS_BUCKET }}/lambda-dotnet/api/ \ No newline at end of file From 4c1c14f268c5672a00b78a721e00c7aaebb53730 Mon Sep 17 00:00:00 2001 From: Henrique Graca <999396+hjgraca@users.noreply.github.com> Date: Wed, 17 May 2023 13:33:37 +0200 Subject: [PATCH 2/4] update api docs generation --- .github/workflows/docs.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 8b8f3057..6d576ec9 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -61,19 +61,15 @@ jobs: uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a with: dotnet-version: 6.0.405 - - name: Install solution dependencies - run: | - dotnet new tool-manifest - dotnet tool install docfx - - name: Create API docs - run: | - dotnet docfx apidocs/docfx.json + - uses: nikeee/docfx-action@b9c2cf92e3b4aa06878a1410833a8828b4bdcd26 #1.0.0 + name: Build Documentation + with: + args: apidocs/docfx.json - name: Release API docs to latest uses: peaceiris/actions-gh-pages@bd8c6b06eba6b3d25d72b7a1767993c0aeee42e7 # v3.9.2 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./apidocs/_site - keep_files: true destination_dir: api - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef From 1f661cbebcf0c52818fca9c29c0eeec4b9b5bfb2 Mon Sep 17 00:00:00 2001 From: Henrique Graca <999396+hjgraca@users.noreply.github.com> Date: Wed, 17 May 2023 13:33:59 +0200 Subject: [PATCH 3/4] Delete on_push_docs.yml --- .github/workflows/on_push_docs.yml | 36 ------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 .github/workflows/on_push_docs.yml diff --git a/.github/workflows/on_push_docs.yml b/.github/workflows/on_push_docs.yml deleted file mode 100644 index dc064215..00000000 --- a/.github/workflows/on_push_docs.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Docs - -on: - push: - branches: - - develop - paths: - - "docs/**" - - "mkdocs.yml" - - "examples/**" - -jobs: - changelog: - permissions: - contents: write - uses: ./.github/workflows/reusable_publish_changelog.yml - - release-docs: - needs: changelog - permissions: - contents: write - pages: write - id-token: write - uses: ./.github/workflows/reusable_publish_docs.yml - with: - version: develop - alias: stage -# Maintenance: Only necessary in repo migration -# - name: Create redirect from old docs -# run: | -# git checkout gh-pages -# test -f 404.html && echo "Redirect already set" && exit 0 -# git checkout develop -- 404.html -# git add 404.html -# git commit -m "chore: set docs redirect" --no-verify -# git push origin gh-pages -f From f7380ed9b7febe248180430bf658d43255b4bd53 Mon Sep 17 00:00:00 2001 From: Henrique Graca <999396+hjgraca@users.noreply.github.com> Date: Wed, 17 May 2023 13:34:40 +0200 Subject: [PATCH 4/4] Update docfx.json --- apidocs/docfx.json | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/apidocs/docfx.json b/apidocs/docfx.json index d3be7774..490abbcc 100644 --- a/apidocs/docfx.json +++ b/apidocs/docfx.json @@ -3,11 +3,8 @@ { "src": [ { - "files": [ - "**/*.csproj" - ], - "src": "../libraries/src/", - "force": true + "files": ["**/*.csproj"], + "src": "../libraries/src/" } ], "dest": "api", @@ -21,23 +18,16 @@ "build": { "content": [ { - "files": ["api/**.yml", "api/index.md"] + "files": ["api/**"] }, { - "files": ["toc.yml", "*.md"] + "files": ["toc.yml", "*.md"], + "exclude": ["_site/**", "**/bin/**", "**/obj/**", "**/[Tt]ests/**"] } ], "resource": [ { - "files": [ - "images/**" - ] - } - ], - "overwrite": [ - { - "files": ["apidoc/**.md"], - "exclude": ["obj/**", "_site/**"] + "files": ["images/**"] } ], "dest": "_site", @@ -60,4 +50,4 @@ "cleanupCacheHistory": false, "disableGitFeatures": false } -} \ No newline at end of file +}