DEV/PROD deploy - @devksingh4 #26
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: Deploy all resources to DEV and PROD | |
run-name: DEV/PROD deploy - @${{ github.actor }} | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy-cf-pages-dev: | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ${{ github.event.repository.name }}-dev | |
cancel-in-progress: false | |
permissions: | |
contents: read | |
deployments: write | |
name: Deploy to Cloudflare Pages DEV | |
environment: "Cloudflare Pages" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node LTS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Build | |
run: corepack enable && yarn && yarn run build | |
env: | |
VITE_RUN_ENVIRONMENT: dev | |
- name: Publish | |
uses: cloudflare/pages-action@v1 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
projectName: ${{ github.event.repository.name }}-dev | |
directory: dist/ | |
gitHubToken: ${{ secrets.GITHUB_TOKEN }} | |
deploy-cf-pages-prod: | |
runs-on: ubuntu-latest | |
needs: | |
- deploy-cf-pages-dev | |
permissions: | |
contents: read | |
deployments: write | |
concurrency: | |
group: ${{ github.event.repository.name }}-prod | |
cancel-in-progress: false | |
name: Deploy to Cloudflare Pages Prod | |
environment: "Cloudflare Pages" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node LTS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Build | |
run: corepack enable && yarn && yarn run build | |
env: | |
VITE_RUN_ENVIRONMENT: prod | |
- name: Publish | |
uses: cloudflare/pages-action@v1 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
projectName: ${{ github.event.repository.name }}-prod | |
directory: dist/ | |
gitHubToken: ${{ secrets.GITHUB_TOKEN }} |