Skip to content

Commit

Permalink
Create deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
minikin committed Nov 13, 2024
1 parent 92299a2 commit 7f04239
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Deploy Catalyst Voices Updates

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
pages: write
id-token: write

steps:
- uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18"

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Upload Preview Artifact
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: github-pages
path: dist
retention-days: 1

- name: Deploy Preview
if: github.event_name == 'pull_request'
uses: actions/deploy-pages@v3
with:
preview: true
artifact_name: github-pages

- name: Add Preview URL Comment
if: github.event_name == 'pull_request'
uses: actions/github-script@v6
with:
script: |
const preview_url = `https://${context.repo.owner}.github.io/${context.repo.repo}/pr-preview/pr-${context.issue.number}`;
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: `🚀 Preview deployment is ready!\nURL: ${preview_url}`
})
- name: Upload Production Artifact
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v3
with:
path: dist

- name: Deploy Production
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/deploy-pages@v3

0 comments on commit 7f04239

Please sign in to comment.