name: website on: push: branches: - master - '*-release' workflow_dispatch: jobs: check_branch: runs-on: ubuntu-latest outputs: should_deploy: ${{ steps.deploy_config.outputs.should_deploy }} target_folder: ${{ steps.deploy_config.outputs.target_folder }} website_base_url: ${{ steps.deploy_config.outputs.website_base_url }} steps: - name: Get version id: get_version if: github.ref_name != 'master' run: | LATEST=$(npm show deck.gl@latest version | grep -o -E "^[0-9]+\.[0-9]+") echo "latest=${LATEST}-release" >> "$GITHUB_OUTPUT" - name: Resolve deploy config id: deploy_config env: LATEST_RELEASE_BRANCH: ${{ steps.get_version.outputs.latest }} run: | if [ "${GITHUB_REF_NAME}" = "master" ]; then echo "should_deploy=true" >> "$GITHUB_OUTPUT" echo "target_folder=next" >> "$GITHUB_OUTPUT" echo "website_base_url=/next/" >> "$GITHUB_OUTPUT" elif [ "${GITHUB_REF_NAME}" = "${LATEST_RELEASE_BRANCH}" ]; then echo "should_deploy=true" >> "$GITHUB_OUTPUT" echo "target_folder=" >> "$GITHUB_OUTPUT" echo "website_base_url=/" >> "$GITHUB_OUTPUT" else echo "should_deploy=false" >> "$GITHUB_OUTPUT" echo "target_folder=" >> "$GITHUB_OUTPUT" echo "website_base_url=/" >> "$GITHUB_OUTPUT" fi deploy: runs-on: ubuntu-latest needs: check_branch concurrency: group: website-gh-pages-${{ needs.check_branch.outputs.target_folder || 'root' }} cancel-in-progress: false permissions: contents: write if: ${{ github.repository_owner == 'visgl' && needs.check_branch.outputs.should_deploy == 'true' }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: token: ${{ secrets.WEBSITE_DEPLOY_TOKEN }} - name: Setup Node.js uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: node-version-file: '.nvmrc' cache: 'yarn' - name: Enable Corepack run: corepack enable yarn - name: Install dependencies run: | yarn bootstrap (cd website && yarn) - name: Build website env: MapboxAccessToken: ${{ secrets.MAPBOX_ACCESS_TOKEN }} GoogleMapsAPIKey: ${{ secrets.GOOGLE_MAPS_API_KEY }} GoogleMapsMapId: ${{ secrets.GOOGLE_MAPS_MAP_ID }} WEBSITE_BASE_URL: ${{ needs.check_branch.outputs.website_base_url }} run: (cd website && yarn build) # Pages checks the branch root, even when the site lives under /next/. - name: Prepare Pages marker run: | mkdir -p "website-pages-marker" touch "website-pages-marker/.nojekyll" - name: Disable Jekyll at the Pages branch root uses: JamesIves/github-pages-deploy-action@fa24774553152dd7873cd16ebd8d959b010c5445 # 4.9.0 with: token: ${{ secrets.WEBSITE_DEPLOY_TOKEN }} branch: gh-pages folder: website-pages-marker clean: false - name: Deploy uses: JamesIves/github-pages-deploy-action@fa24774553152dd7873cd16ebd8d959b010c5445 # 4.9.0 with: token: ${{ secrets.WEBSITE_DEPLOY_TOKEN }} branch: gh-pages folder: website/build target-folder: ${{ needs.check_branch.outputs.target_folder }} clean: true clean-exclude: | next .nojekyll