S3 Testing and adjustments (#1386) #343
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy website to Pages | |
on: | |
push: | |
paths: | |
- "website/**" | |
- "docs/**" | |
pull_request: | |
paths: | |
- "website/**" | |
- "docs/**" | |
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab | |
permissions: # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
contents: read | |
pages: write | |
id-token: write | |
defaults: # Default to bash | |
run: | |
shell: bash | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_run' || github.event_name == 'push' || github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id | |
outputs: | |
has_pages: ${{ steps.has-pages.outputs.has_pages }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set has Pages | |
id: has-pages | |
run: echo "has_pages=$(gh api repos/${{ github.repository }} --jq .has_pages)" >> $GITHUB_OUTPUT | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "18" | |
cache: yarn | |
cache-dependency-path: website/yarn.lock | |
- name: Setup Pages | |
id: pages | |
uses: actions/configure-pages@v5 | |
if: steps.has-pages.outputs.has_pages == 'true' | |
- name: Restore cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
website/build | |
website/.docusaurus | |
key: ${{ runner.os }}-docusaurus-build-${{ hashFiles('website/build') }} | |
restore-keys: | | |
${{ runner.os }}-docusaurus-build- | |
- name: Install dependencies | |
working-directory: ./website | |
run: yarn install | |
- name: Build | |
working-directory: ./website | |
run: yarn run build | |
- name: Upload artifact | |
if: github.ref == 'refs/heads/main' && steps.has-pages.outputs.has_pages == 'true' | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./website/build | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.ref == 'refs/heads/main' && needs.build.outputs.has_pages == 'true' | |
concurrency: # Allow one concurrent deployment | |
group: "pages" | |
cancel-in-progress: true | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |