Automatic build and deploy for Development environment #43
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: build-and-deploy | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
environment: | |
type: environment | |
required: true | |
description: Environment for deployment | |
repository_dispatch: | |
types: | |
- content-updated | |
run-name: >- | |
${{ github.event_name == 'workflow_dispatch' && 'Manual' || 'Automatic' }} | |
build and deploy for | |
${{ inputs.environment || github.event.client_payload.environment || 'Development' }} environment | |
jobs: | |
update: | |
timeout-minutes: 5 | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
runs-on: ubuntu-latest | |
environment: | |
name: ${{ inputs.environment || github.event.client_payload.environment || 'Development' }} | |
url: ${{ steps.deploy.outputs.url }} | |
permissions: | |
contents: read | |
deployments: write | |
name: Publish to Cloudflare Pages | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: oven-sh/setup-bun@v1 | |
- name: Resolve Dependencies | |
run: bun install --frozen-lockfile | |
env: | |
HUSKY: 0 | |
- name: Build application | |
run: bun --cwd=apps/web run build | |
env: | |
CONTENTFUL_ENV: ${{ vars.CONTENTFUL_ENV }} | |
CONTENTFUL_SPACE_ID: ${{ vars.CONTENTFUL_SPACE_ID }} | |
CONTENTFUL_DELIVERY_TOKEN: ${{ secrets.CONTENTFUL_DELIVERY_TOKEN }} | |
- name: Publish to Cloudflare Pages | |
id: deploy | |
uses: cloudflare/pages-action@v1 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ vars.CLOUDFLARE_ACCOUNT_ID }} | |
projectName: nordenwinds | |
directory: apps/web/dist | |
# gitHubToken: ${{ secrets.GITHUB_TOKEN }} | |
wranglerVersion: '3' |