diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 0bbd082..58667a0 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -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 @@ -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: | @@ -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