Restore to nearly working

This commit is contained in:
Hamish Willee
2025-10-01 11:13:44 +10:00
committed by GitHub
parent 767a765ddd
commit c3b5a83d3e
+6 -16
View File
@@ -15,11 +15,12 @@ on:
- "docs/zh/**" - "docs/zh/**"
- "docs/uk/**" - "docs/uk/**"
- "docs/ko/**" - "docs/ko/**"
workflow_dispatch: workflow_dispatch:
permissions: permissions:
contents: read contents: read
id-token: write id-token: write # for AWS OIDC
concurrency: concurrency:
group: docs-deploy group: docs-deploy
@@ -39,8 +40,6 @@ jobs:
spot=false, spot=false,
extras=s3-cache, extras=s3-cache,
] ]
outputs:
branch_name: ${{ steps.derive.outputs.branch_name }}
steps: steps:
- uses: runs-on/action@v1 - uses: runs-on/action@v1
@@ -48,14 +47,12 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Derive branch name - name: Derive branch name
id: derive
run: | run: |
BRANCH="${RAW_BRANCH_NAME}" BRANCH="${RAW_BRANCH_NAME}"
if [[ "$BRANCH" =~ ^release/(.*) ]]; then if [[ "$BRANCH" =~ ^release/(.*) ]]; then
BRANCH="v${BASH_REMATCH[1]}" BRANCH="v${BASH_REMATCH[1]}"
fi fi
echo "branch_name=$BRANCH" >> $GITHUB_OUTPUT echo "BRANCH_NAME=$BRANCH" >> $GITHUB_ENV
echo "Derived branch name: $BRANCH"
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v4 uses: actions/setup-node@v4
@@ -69,10 +66,7 @@ jobs:
- name: Build with VitePress - name: Build with VitePress
working-directory: ./docs working-directory: ./docs
env:
BRANCH_NAME: ${{ steps.derive.outputs.branch_name }}
run: | run: |
echo "BRANCH_NAME is: $BRANCH_NAME"
npm run docs:build_ubuntu npm run docs:build_ubuntu
touch .vitepress/dist/.nojekyll touch .vitepress/dist/.nojekyll
npm run docs:sitemap 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' }} if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.merged) || github.event_name == 'workflow_dispatch' }}
needs: build needs: build
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
BRANCH_NAME: ${{ needs.build.outputs.branch_name }}
steps: steps:
- name: Download Artifact - name: Download Artifact
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
@@ -107,19 +100,16 @@ jobs:
- name: Sanity check AWS credentials - name: Sanity check AWS credentials
run: aws sts get-caller-identity 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 - name: Upload HTML with short cache
run: | run: |
aws s3 sync ~/_book/ s3://px4-docs/${BRANCH_NAME}/ \ aws s3 sync ~/_book/ s3://px4-docs/${{ env.BRANCH_NAME }}/ \
--delete \ --delete \
--exclude "*" --include "*.html" \ --exclude "*" --include "*.html" \
--cache-control "public, max-age=60" --cache-control "public, max-age=60"
- name: Upload assets with long cache - name: Upload assets with long cache
run: | run: |
aws s3 sync ~/_book/ s3://px4-docs/${BRANCH_NAME}/ \ aws s3 sync ~/_book/ s3://px4-docs/${{ env.BRANCH_NAME }}/ \
--delete \ --delete \
--exclude "*.html" \ --exclude "*.html" \
--cache-control "public, max-age=86400, immutable" --cache-control "public, max-age=86400, immutable"