diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 15eb79718..0b56cae0d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,15 +1,16 @@ -name: Deploy to GitHub Pages +name: Deploy to Cloudflare Pages on: push: branches: - main + permissions: contents: read jobs: build-and-deploy: - name: Build Docusaurus and Storybook + name: Build and Deploy to Cloudflare Pages runs-on: ubuntu-latest steps: - name: Checkout code @@ -35,24 +36,9 @@ jobs: mkdir -p docs/build/storybook cp -r bulma-ui/storybook-static/* docs/build/storybook/ - - name: Upload Build Artifact - uses: actions/upload-pages-artifact@v3 + - name: Deploy to Cloudflare Pages + uses: cloudflare/wrangler-action@v3 with: - path: docs/build - - deploy: - name: Deploy to GitHub Pages - needs: build-and-deploy - runs-on: ubuntu-latest - permissions: - pages: write - id-token: write - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - outputs: - page_url: ${{ steps.deployment.outputs.page_url }} - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + command: pages deploy docs/build --project-name=bestax --commit-dirty=true diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml index 951f57829..78c2c4be3 100644 --- a/.github/workflows/test-deploy.yml +++ b/.github/workflows/test-deploy.yml @@ -4,14 +4,14 @@ on: pull_request: branches: - main - # Review gh actions docs if you want to further define triggers, paths, etc - # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on + permissions: contents: read + pull-requests: write jobs: test-deploy: - name: Test Docusaurus deployment + name: Test and Preview Deployment runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -24,5 +24,32 @@ jobs: - name: Install dependencies run: npm ci - - name: Test build website + - name: Build Docusaurus run: npm run build -- --filter=@allxsmith/bestax-docs + + - name: Build Storybook + run: npm run build-storybook -w bulma-ui + + - name: Copy Storybook to Docusaurus build + run: | + mkdir -p docs/build/storybook + cp -r bulma-ui/storybook-static/* docs/build/storybook/ + + - name: Deploy Preview to Cloudflare Pages + uses: cloudflare/wrangler-action@v3 + id: deploy + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + command: pages deploy docs/build --project-name=bestax --branch=${{ github.head_ref }} --commit-dirty=true + + - name: Comment Preview URL + uses: actions/github-script@v7 + with: + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: '## Preview Deployment\n\nPreview URL: ${{ steps.deploy.outputs.deployment-url }}' + }) diff --git a/docs/static/CNAME b/docs/static/CNAME deleted file mode 100644 index 0e9033b30..000000000 --- a/docs/static/CNAME +++ /dev/null @@ -1 +0,0 @@ -bestax.io