| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, |
| # software distributed under the License is distributed on an |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| # KIND, either express or implied. See the License for the |
| # specific language governing permissions and limitations |
| # under the License. |
| |
| name: Deploy |
| |
| on: |
| push: |
| branches: |
| - main |
| - 'preview/*' |
| |
| permissions: |
| contents: write |
| |
| concurrency: |
| group: site-deploy-${{ github.ref_name }} |
| cancel-in-progress: true |
| |
| jobs: |
| deploy: |
| name: Site |
| runs-on: ubuntu-latest |
| steps: |
| - name: Check out repository |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 |
| - name: Set up Node.js |
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7 |
| with: |
| node-version: 24 |
| - name: Build site |
| run: | |
| corepack enable pnpm |
| pnpm install --frozen-lockfile |
| pnpm build |
| - name: Select publish branch |
| id: publish |
| env: |
| SOURCE_BRANCH: ${{ github.ref_name }} |
| run: | |
| if [ "$SOURCE_BRANCH" = main ]; then |
| publish_branch=asf-site |
| else |
| publish_branch="site/${SOURCE_BRANCH#preview/}-staging" |
| fi |
| echo "branch=$publish_branch" >> "$GITHUB_OUTPUT" |
| - name: Publish site (${{ steps.publish.outputs.branch }}) |
| uses: peaceiris/actions-gh-pages@84c30a85c19949d7eee79c4ff27748b70285e453 # v4.1.0 |
| with: |
| github_token: ${{ secrets.GITHUB_TOKEN }} |
| publish_dir: ./build |
| publish_branch: ${{ steps.publish.outputs.branch }} |