Skip to content

Commit

Permalink
Update deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
minikin committed Nov 13, 2024
1 parent 078230a commit cec6568
Showing 1 changed file with 41 additions and 58 deletions.
99 changes: 41 additions & 58 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- main
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:

jobs:
build:
Expand All @@ -17,7 +18,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Dart
uses: dart-lang/setup-dart@v1
Expand All @@ -28,13 +29,6 @@ jobs:
- 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:
Expand All @@ -58,59 +52,48 @@ jobs:
group: "pages"
cancel-in-progress: false

steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2

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@v5
uses: actions/configure-pages@v4

- name: Deploy to GitHub Pages
- name: Deploy Preview
id: deployment
uses: actions/deploy-pages@v2

# 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}`
# })
- 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}`
})

0 comments on commit cec6568

Please sign in to comment.