Skip to content

Update deploy.yml

Update deploy.yml #2

Workflow file for this run

name: 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
defaults:
run:
working-directory: ./packages/static_shock_docs
steps:
- uses: actions/checkout@v3
- name: Setup Dart
uses: dart-lang/setup-dart@v1
- name: Install dependencies
run: dart pub get
- name: Build site
run: dart run bin/main.dart
- 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: ./build
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: ./build
- name: Deploy Production
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/deploy-pages@v3