Update deploy.yml #10
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 | |
pages: write | |
id-token: write | |
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 build directory | |
run: | | |
echo "Current directory contents:" | |
ls -la | |
echo "Build directory contents:" | |
ls -la build || echo "Build directory not found" | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
name: github-pages | |
path: build | |
deploy-production: | |
needs: build | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
permissions: | |
pages: write | |
id-token: write | |
deployments: write | |
statuses: write | |
contents: read | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
steps: | |
- name: Configure Pages | |
uses: actions/configure-pages@v4 | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: github-pages | |
path: build | |
- name: Debug downloaded artifact | |
run: | | |
echo "Downloaded contents:" | |
ls -la build | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 | |
with: | |
artifact_name: github-pages | |
# deploy-preview: | |
# needs: build | |
# if: github.event_name == 'pull_request' | |
# runs-on: ubuntu-latest | |
# permissions: | |
# pages: write | |
# id-token: write | |
# pull-requests: write | |
# deployments: write | |
# statuses: write | |
# contents: read | |
# environment: | |
# name: preview | |
# url: ${{ steps.deployment.outputs.page_url }} | |
# concurrency: | |
# group: "pages-pr-${{ github.event.pull_request.number }}" | |
# cancel-in-progress: true | |
# steps: | |
# - name: Configure Pages | |
# uses: actions/configure-pages@v4 | |
# - name: Download artifact | |
# uses: actions/download-artifact@v4 | |
# with: | |
# name: github-pages | |
# path: build | |
# - name: Deploy Preview | |
# id: deployment | |
# uses: actions/deploy-pages@v2 | |
# with: | |
# artifact_name: github-pages | |
# - name: Add Preview URL Comment | |
# 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}` | |
# }) |