Add Content Manager #40
Workflow file for this run
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: Preview fork deploys | |
on: | |
push: | |
pull_request: | |
jobs: | |
# Assumes that if you have an API key set, the other secrets are also present | |
check-api-key: | |
runs-on: ubuntu-latest | |
outputs: | |
api-key: ${{ steps.api-key-check.outputs.defined }} | |
steps: | |
- name: Check for Cloudflare API secrets | |
id: api-key-check | |
# perform secret check & put boolean result as an output | |
shell: bash | |
run: | | |
if [ "${{ secrets.CLOUDFLARE_API_TOKEN }}" != '' ]; then | |
echo "defined=true" >> $GITHUB_OUTPUT; | |
else | |
echo "defined=false" >> $GITHUB_OUTPUT; | |
fi | |
preview: | |
runs-on: ubuntu-latest | |
needs: [check-api-key] | |
if: needs.check-api-key.outputs.api-key == 'true' | |
permissions: | |
contents: read | |
deployments: write | |
name: Publish preview to Cloudflare Pages | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install node.js v18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: npm | |
- name: Install dependencies | |
run: npm ci | |
- name: Build guide | |
run: npm run docs:build | |
- name: Publish to Cloudflare Pages | |
uses: cloudflare/pages-action@1 | |
id: cloudflare | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
projectName: ${{ secrets.CLOUDFLARE_PROJECTNAME || 'rocketleaguemapmaking' }} | |
directory: docs/.vitepress/dist | |
# Enable GitHub deployments | |
gitHubToken: ${{ secrets.GITHUB_TOKEN }} | |
- name: Log | |
run: echo "Deployed preview site on ${{ steps.cloudflare.outputs.url }}" |