Skip to content

Commit

Permalink
chore: Update deployment scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
shyakadavis committed Aug 3, 2024
1 parent e1a035b commit b843c69
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 48 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/build-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build Preview Deployment

# cancel in-progress runs on new commits to same PR (github.event.number)
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true

on:
pull_request:
types: [opened, synchronize]

jobs:
build-preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm

- name: Install dependencies
run: pnpm install

- name: Build site
run: pnpm build

- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: preview-build
path: build
37 changes: 37 additions & 0 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Upload Preview Deployment

on:
workflow_run:
workflows: ['Build Preview Deployment']
types:
- completed

permissions:
actions: read
deployments: write
contents: read
pull-requests: write

jobs:
deploy-preview:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: preview-build
path: build
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}

- name: Deploy to Cloudflare Pages
uses: AdrianGonz97/refined-cf-pages-action@v1
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
githubToken: ${{ secrets.GITHUB_TOKEN }}
projectName: mode-watcher
directory: ./.svelte-kit/cloudflare
workingDirectory: sites/docs
deploymentName: Preview
42 changes: 42 additions & 0 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Production Deployment
on:
push:
branches:
- main
paths:
- sites/docs/**
- packages/mode-watcher/**

jobs:
deploy-production:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
name: Deploy Production Site to Cloudflare Pages
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm

- name: Install dependencies
run: pnpm install

- name: Build site
run: pnpm build

- name: Deploy to Cloudflare Pages
uses: AdrianGonz97/refined-cf-pages-action@v1
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
githubToken: ${{ secrets.GITHUB_TOKEN }}
projectName: mode-watcher
directory: ./.svelte-kit/cloudflare
workingDirectory: sites/docs
deploymentName: Production
48 changes: 0 additions & 48 deletions .github/workflows/production.yml

This file was deleted.

0 comments on commit b843c69

Please sign in to comment.