Update deploy.yml #6
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: 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 | |
outputs: | |
page_url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Checkout | |
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: Debug directory | |
run: | | |
echo "Contents of current directory:" | |
ls -la | |
echo "Contents of build directory:" | |
ls -la build || echo "Build directory not found" | |
- name: Setup Pages | |
uses: actions/configure-pages@v4 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: build | |
- name: Deploy to GitHub Pages | |
id: deployment | |
if: github.ref == 'refs/heads/main' | |
uses: actions/deploy-pages@v3 | |
preview: | |
needs: build | |
if: github.event_name == 'pull_request' | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Comment PR | |
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}` | |
}) |