Merge pull request #277 from CallumWatkins/dependabot/npm_and_yarn/cl… #165
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: CD | |
on: | |
push: | |
branches: [master] | |
workflow_call: | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
deploy: | |
name: Deploy (CF Pages) | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
pull-requests: write | |
steps: | |
- name: Comment deploy start | |
if: github.event_name == 'pull_request' | |
uses: mshick/add-pr-comment@v2 | |
with: | |
message-id: cloudflare-deploy | |
message: | | |
### <span aria-hidden="true">🚧</span> Deploy Preview building... | |
| Name | Link | | |
| :-- | :-- | | |
|<span aria-hidden="true">🔨</span> Latest commit | ${{ github.sha }} | | |
|<span aria-hidden="true">🔍</span> Latest deploy log | ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: npm ci | |
- name: Build and pre-render Nuxt app | |
run: npm run generate | |
- name: Publish to Cloudflare Pages | |
id: cf-pages-publish | |
uses: cloudflare/pages-action@v1 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
projectName: ${{ secrets.CLOUDFLARE_PROJECT_NAME }} | |
directory: .output/public | |
- name: Comment deploy URL | |
if: github.event_name == 'pull_request' | |
uses: mshick/add-pr-comment@v2 | |
with: | |
message-id: cloudflare-deploy | |
message: | | |
### <span aria-hidden="true">✅</span> Deploy Preview ready! | |
| Name | Link | | |
| :-- | :-- | | |
|<span aria-hidden="true">🔨</span> Latest commit | ${{ github.sha }} | | |
|<span aria-hidden="true">🔍</span> Latest deploy log | ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | | |
|<span aria-hidden="true">😎</span> Deploy Preview URL | [${{ steps.cf-pages-publish.outputs.url }}](${{ steps.cf-pages-publish.outputs.url }}) | | |
|<span aria-hidden="true">🌳</span> Environment | ${{ steps.cf-pages-publish.outputs.environment }} | |