mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-27 18:27:05 +08:00
ci: docs deploy branchname for build step (#25684)
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
This commit is contained in:
@@ -26,9 +26,6 @@ concurrency:
|
|||||||
group: docs-deploy
|
group: docs-deploy
|
||||||
cancel-in-progress: false
|
cancel-in-progress: false
|
||||||
|
|
||||||
env:
|
|
||||||
RAW_BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on:
|
runs-on:
|
||||||
@@ -40,19 +37,23 @@ jobs:
|
|||||||
spot=false,
|
spot=false,
|
||||||
extras=s3-cache,
|
extras=s3-cache,
|
||||||
]
|
]
|
||||||
|
outputs:
|
||||||
|
branchname: ${{ steps.set-branch.outputs.branchname }}
|
||||||
|
releaseversion: ${{ steps.set-version.outputs.releaseversion }}
|
||||||
steps:
|
steps:
|
||||||
- uses: runs-on/action@v1
|
- uses: runs-on/action@v1
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Derive branch name
|
- id: set-branch
|
||||||
|
run: echo "::set-output name=branchname::${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
|
||||||
|
|
||||||
|
- id: set-version
|
||||||
run: |
|
run: |
|
||||||
BRANCH="${RAW_BRANCH_NAME}"
|
branch="${{ steps.set-branch.outputs.branchname }}"
|
||||||
if [[ "$BRANCH" =~ ^release/(.*) ]]; then
|
version="v${branch#release/}"
|
||||||
BRANCH="v${BASH_REMATCH[1]}"
|
echo "::set-output name=releaseversion::$version"
|
||||||
fi
|
|
||||||
echo "BRANCH_NAME=$BRANCH" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
@@ -66,6 +67,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Build with VitePress
|
- name: Build with VitePress
|
||||||
working-directory: ./docs
|
working-directory: ./docs
|
||||||
|
env:
|
||||||
|
BRANCH_NAME: ${{ steps.set-version.outputs.releaseversion }}
|
||||||
run: |
|
run: |
|
||||||
npm run docs:build_ubuntu
|
npm run docs:build_ubuntu
|
||||||
touch .vitepress/dist/.nojekyll
|
touch .vitepress/dist/.nojekyll
|
||||||
@@ -102,14 +105,14 @@ jobs:
|
|||||||
|
|
||||||
- name: Upload HTML with short cache
|
- name: Upload HTML with short cache
|
||||||
run: |
|
run: |
|
||||||
aws s3 sync ~/_book/ s3://px4-docs/${{ env.BRANCH_NAME }}/ \
|
aws s3 sync ~/_book/ s3://px4-docs/${{ needs.build.outputs.versionname }}/ \
|
||||||
--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/${{ env.BRANCH_NAME }}/ \
|
aws s3 sync ~/_book/ s3://px4-docs/${{ needs.build.outputs.versionname }}/ \
|
||||||
--delete \
|
--delete \
|
||||||
--exclude "*.html" \
|
--exclude "*.html" \
|
||||||
--cache-control "public, max-age=86400, immutable"
|
--cache-control "public, max-age=86400, immutable"
|
||||||
|
|||||||
Reference in New Issue
Block a user