Merge pull request #145 from cryptomator/feature/improve-security #118
This file contains hidden or 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: Deploy to GitHub Pages | |
| on: | |
| push: | |
| branches: ["main", "develop"] | |
| workflow_dispatch: | |
| jobs: | |
| # BUILD | |
| build: | |
| name: Build Site | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v5 | |
| - name: Verify lockfile has no non-registry sources | |
| run: scripts/check-lockfile.sh | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build production | |
| run: pnpm run build | |
| - name: Upload Prod Pages artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| name: prod-site | |
| path: './build' | |
| - name: Build staging | |
| run: pnpm run build | |
| env: | |
| SITE_URL: https://docs.staging.cryptomator.org | |
| - name: Add robots.txt for staging | |
| run: 'echo -e "User-agent: *\nDisallow: /" > build/robots.txt' | |
| - name: Upload Staging artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: staging-site | |
| path: './build' | |
| # DEPLOY PROD | |
| deploy-prod: | |
| if: github.ref == 'refs/heads/main' | |
| name: Deploy Prod to GitHub Pages | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| permissions: | |
| pages: write | |
| id-token: write | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| with: | |
| artifact_name: prod-site | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| # DEPLOY STAGING | |
| deploy-staging: | |
| if: github.ref == 'refs/heads/develop' | |
| name: Deploy Staging to GitHub Pages | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| steps: | |
| - name: Download build | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: staging-site | |
| path: ./public | |
| - name: Deploy to Staging Repository | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| personal_token: ${{ secrets.CRYPTOBOT_DEPLOY_STAGING_DOCS }} | |
| external_repository: cryptomator/docs-staging | |
| publish_dir: ./public | |
| publish_branch: main | |
| cname: docs.staging.cryptomator.org |