Deploy Docs #1
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 Docs | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| environment: | |
| description: "Select deployment environment" | |
| required: true | |
| default: "preview" | |
| type: choice | |
| options: | |
| - production | |
| - preview | |
| jobs: | |
| manual-deploy-docs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: "https://registry.npmjs.org" | |
| - run: corepack enable | |
| - run: yarn install --immutable | |
| - run: yarn build | |
| - name: Set branch name for Cloudflare Pages | |
| id: cf-branch | |
| run: | | |
| if [[ "${{ github.ref_name }}" == "production" ]]; then | |
| echo "CF_BRANCH_NAME=master" >> $GITHUB_ENV | |
| else | |
| echo "CF_BRANCH_NAME=preview" >> $GITHUB_ENV | |
| fi | |
| - name: Publish Docs to Cloudflare Pages | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| gitHubToken: ${{ secrets.GITHUB_TOKEN }} | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: 167153f505df751a355a8192b0656720 | |
| command: pages deploy ./docs/build --project-name=sprinter-docs --branch=${{ env.CF_BRANCH_NAME }} |