diff --git a/.github/workflows/docs_deploy_aws.yml b/.github/workflows/docs_deploy_aws.yml index c9c6f40a54..f2b37d7cb3 100644 --- a/.github/workflows/docs_deploy_aws.yml +++ b/.github/workflows/docs_deploy_aws.yml @@ -15,11 +15,12 @@ on: - "docs/zh/**" - "docs/uk/**" - "docs/ko/**" + workflow_dispatch: permissions: contents: read - id-token: write + id-token: write # for AWS OIDC concurrency: group: docs-deploy @@ -39,8 +40,6 @@ jobs: spot=false, extras=s3-cache, ] - outputs: - branch_name: ${{ steps.derive.outputs.branch_name }} steps: - uses: runs-on/action@v1 @@ -48,14 +47,12 @@ jobs: uses: actions/checkout@v4 - name: Derive branch name - id: derive run: | BRANCH="${RAW_BRANCH_NAME}" if [[ "$BRANCH" =~ ^release/(.*) ]]; then BRANCH="v${BASH_REMATCH[1]}" fi - echo "branch_name=$BRANCH" >> $GITHUB_OUTPUT - echo "Derived branch name: $BRANCH" + echo "BRANCH_NAME=$BRANCH" >> $GITHUB_ENV - name: Setup Node uses: actions/setup-node@v4 @@ -69,10 +66,7 @@ jobs: - name: Build with VitePress working-directory: ./docs - env: - BRANCH_NAME: ${{ steps.derive.outputs.branch_name }} run: | - echo "BRANCH_NAME is: $BRANCH_NAME" npm run docs:build_ubuntu touch .vitepress/dist/.nojekyll npm run docs:sitemap @@ -89,8 +83,7 @@ jobs: if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.merged) || github.event_name == 'workflow_dispatch' }} needs: build runs-on: ubuntu-latest - env: - BRANCH_NAME: ${{ needs.build.outputs.branch_name }} + steps: - name: Download Artifact uses: actions/download-artifact@v4 @@ -107,19 +100,16 @@ jobs: - name: Sanity check AWS credentials run: aws sts get-caller-identity - - name: Echo branch name for deploy - run: echo "Deploying to branch path: $BRANCH_NAME" - - name: Upload HTML with short cache run: | - aws s3 sync ~/_book/ s3://px4-docs/${BRANCH_NAME}/ \ + aws s3 sync ~/_book/ s3://px4-docs/${{ env.BRANCH_NAME }}/ \ --delete \ --exclude "*" --include "*.html" \ --cache-control "public, max-age=60" - name: Upload assets with long cache run: | - aws s3 sync ~/_book/ s3://px4-docs/${BRANCH_NAME}/ \ + aws s3 sync ~/_book/ s3://px4-docs/${{ env.BRANCH_NAME }}/ \ --delete \ --exclude "*.html" \ --cache-control "public, max-age=86400, immutable"