actions / deploy-pages

GitHub Action to publish artifacts to GitHub Pages for deployments
https://pages.github.com
MIT License
658 stars 79 forks source link

Flutter web app + Artifact could not be deployed error #368

Open austinmilt opened 2 months ago

austinmilt commented 2 months ago

I'm trying to publish the Flutter default app (made with flutter create) to my repo's GitHub Pages. My workflow file is as follows:


name: Publish main branch to GitHub Pages

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
    contents: read
    pages: write      # to deploy to Pages
    id-token: write   # to verify the deployment originates from an appropriate source

jobs:
  build:
    runs-on: ubuntu-latest
    steps:

      - name: Clone the source repo
        uses: actions/checkout@v4

      # https://github.com/marketplace/actions/flutter-action
      - name: Set up Flutter
        uses: subosito/flutter-action@v2
        with:
          channel: stable
          flutter-version: 3.24.0

      - name: Build the web artifact
        run: |
          flutter pub get
          flutter test
          flutter build web --base-href /${{ github.event.repository.name }}/ --release

      - name: Configure Pages
        uses: actions/configure-pages@v4

      - name: Upload the web artifact
        uses: actions/upload-artifact@v4
        with:
          name: github-pages
          path: build/web

  # https://github.com/actions/deploy-pages
  deploy:
    runs-on: ubuntu-latest
    needs: build
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}

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

The build artifact is successfully uploaded and appears correct

With the provided path, there will be 31 files uploaded
Artifact name is valid!
Root directory input is valid!
Beginning upload of artifact content to blob storage
Uploaded bytes 7436117
Finished uploading artifact content to blob storage!
SHA256 hash of uploaded artifact zip is 2669ae79bd709d99ca67b64104e824cbabe608a56ab8ef3788a621e007f410[15](https://github.com/austinmilt/cthulu_character_creator/actions/runs/10445530658/job/28921814519#step:6:16)
Finalizing artifact upload
Artifact github-pages.zip successfully finalized. Artifact ID 1825503194
Artifact github-pages has been successfully uploaded! Final size is 74361[17](https://github.com/austinmilt/cthulu_character_creator/actions/runs/10445530658/job/28921814519#step:6:18) bytes. Artifact ID is 1825503194
Artifact download URL: https://github.com/austinmilt/cthulu_character_creator/actions/runs/10445530658/artifacts/[18](https://github.com/austinmilt/cthulu_character_creator/actions/runs/10445530658/job/28921814519#step:6:19)25503194

This works up until deploy-pages which fails with error

Artifact could not be deployed. Please ensure the content does not contain any hard links, symlinks and total size is less than 10GB.

I've confirmed there are no (file) links.

Debug logs (attached) logs_27310942169.zip do not give me more info.

I've seen examples of flutter web apps successfully publishing to GitHub Pages, so I have some confidence this should work. I'm wondering if there are some gotchas I'm missing, or if there's another way to debug this process.

mglsj commented 1 week ago

Use upload-pages-artifact instead of upload-artifact

      - name: Upload the web artifact
-        uses: actions/upload-artifact@v4
+        uses: actions/upload-pages-artifact@v3
        with:
          name: github-pages
          path: build/web