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 2c5b468 commit 3fb37ab
Showing 1 changed file with 22 additions and 48 deletions.
70 changes: 22 additions & 48 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ jobs:
pages: write
id-token: write

outputs:
page_url: ${{ steps.deployment.outputs.page_url }}

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

- name: Setup Dart
uses: dart-lang/setup-dart@v1
Expand All @@ -28,35 +32,35 @@ jobs:
- name: Build site
run: dart run bin/main.dart

- name: Check build directory before setup
- name: Debug directory
run: |
echo "Current directory:"
pwd
echo "Directory contents:"
echo "Contents of current directory:"
ls -la
echo "Build directory contents:"
echo "Contents of build directory:"
ls -la build || echo "Build directory not found"
- name: Setup Pages
uses: actions/configure-pages@v4

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

- name: Deploy Preview
if: github.event_name == 'pull_request'
- name: Deploy to GitHub Pages
id: deployment
if: github.ref == 'refs/heads/main'
uses: actions/deploy-pages@v3
with:
preview: true
artifact_name: github-pages

- name: Add Preview URL Comment
if: github.event_name == 'pull_request'
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: |
Expand All @@ -67,33 +71,3 @@ jobs:
issue_number: context.issue.number,
body: `🚀 Preview deployment is ready!\nURL: ${preview_url}`
})
- name: Check build directory before production upload
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
echo "Current directory:"
pwd
echo "Directory contents:"
ls -la
echo "Build directory contents:"
ls -la build || echo "Build directory not found"
- name: Upload Production Artifact
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v3
with:
name: github-pages
path: build
if-no-files-found: error

- name: List artifacts after upload
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
echo "Artifacts in runner:"
find /home/runner/work -name "github-pages*"
- name: Deploy Production
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/deploy-pages@v3
with:
artifact_name: github-pages

0 comments on commit 3fb37ab

Please sign in to comment.