action-gh-release icon indicating copy to clipboard operation
action-gh-release copied to clipboard

Artefacts not being uploaded to release

Open eggbean opened this issue 2 years ago • 10 comments
trafficstars

I have made a GitHub Action to make mosh statically-linked binaries. I am updating another person's build action which used the deprecated release action.

I have a multi-architecture matrix which builds successfully, packages the files and uploads the zipped artefact:

      - name: Upload package
        uses: actions/upload-artifact@v3
        with:
          name: mosh-${{ matrix.arch }}.tar.gz
          path: mosh-${{ matrix.arch }}.tar.gz
        if-no-files-found: error

I see the uploaded artefacts called mosh-x86_64.tar.gz and mosh-aarch64.tar.gz in the web interface.

Then in the same actions.yml a new instance does the release like this:

  release:
    needs: [build]
    runs-on: ubuntu-latest
    steps:
      - name: Get release version
        run: |
          export tag="$(curl -s https://api.github.com/repos/mobile-shell/mosh/releases/latest | jq -r '.tag_name')"
          echo "version=${tag}" >> $GITHUB_ENV

      - name: Download packages
        uses: actions/download-artifact@v3

      - name: Publish archives and packages
        uses: softprops/action-gh-release@v1
        with:
          tag_name: ${{ env.version }}
          files: |
            mosh-x86_64.tar.gz
            mosh-aarch64.tar.gz
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

The tarballs don't appear in the release and the log ends with this:

2023-03-27T00:21:52.8210661Z 🤔 Pattern 'mosh-x86_64.tar.gz' does not match any files.
2023-03-27T00:21:52.8213299Z 🤔 Pattern 'mosh-aarch64.tar.gz' does not match any files.
2023-03-27T00:21:53.4174666Z 🤔 mosh-x86_64.tar.gz,mosh-aarch64.tar.gz not include valid file.

What am I doing wrong?

eggbean avatar Mar 26 '23 15:03 eggbean

Try to run an ls command to see how your files are being downloaded. I suspect your artifacts are inside an extra folder.

  • run: ls -lhrt

LucasJC avatar Apr 01 '23 20:04 LucasJC

I think I have a similar issue...

      - name: Download artifacts
        uses: actions/download-artifact@v3
        with:
          path: ./binaries

      - name: Create a release
        uses: softprops/action-gh-release@v1
        with:
          files: |
            ./binaries/*

The logs say artifacts are downloaded as

Artifact cargo-careful.exe was downloaded to /home/runner/work/cargo-careful/cargo-careful/binaries/cargo-careful.exe
Artifact cargo-careful-x86_64-apple-darwin was downloaded to /home/runner/work/cargo-careful/cargo-careful/binaries/cargo-careful-x86_64-apple-darwin
Artifact cargo-careful-x86_64-unknown-linux-musl was downloaded to /home/runner/work/cargo-careful/cargo-careful/binaries/cargo-careful-x86_64-unknown-linux-musl
Artifact download has finished successfully

but then the release action says

🤔 Pattern './binaries/*' does not match any files.
👩‍🏭 Creating new GitHub release for tag v0.3.2...
🤔 ./binaries/* not include valid file.

Are the two actions using different working directories, or something like that? Not sure what is happening.

RalfJung avatar Apr 21 '23 20:04 RalfJung

I added some ls for debugging and it looks as expected. ls -lah binaries prints

drwxr-xr-x 5 runner docker 4.0K Apr 22 13:17 .
drwxr-xr-x 7 runner docker 4.0K Apr 22 13:17 ..
drwxr-xr-x 2 runner docker 4.0K Apr 22 13:17 cargo-careful-x86_64-apple-darwin
drwxr-xr-x 2 runner docker 4.0K Apr 22 13:17 cargo-careful-x86_64-unknown-linux-musl
drwxr-xr-x 2 runner docker 4.0K Apr 22 13:17 cargo-careful.exe

But for some reason the release action claims that ./binaries/* does not match any file.

RalfJung avatar Apr 22 '23 13:04 RalfJung

I have made a GitHub Action to make mosh statically-linked binaries. I am updating another person's build action which used the deprecated release action.

I have a multi-architecture matrix which builds successfully, packages the files and uploads the zipped artefact:

      - name: Upload package
        uses: actions/upload-artifact@v3
        with:
          name: mosh-${{ matrix.arch }}.tar.gz
          path: mosh-${{ matrix.arch }}.tar.gz
        if-no-files-found: error

I see the uploaded artefacts called mosh-x86_64.tar.gz and mosh-aarch64.tar.gz in the web interface.

Then in the same actions.yml a new instance does the release like this:

  release:
    needs: [build]
    runs-on: ubuntu-latest
    steps:
      - name: Get release version
        run: |
          export tag="$(curl -s https://api.github.com/repos/mobile-shell/mosh/releases/latest | jq -r '.tag_name')"
          echo "version=${tag}" >> $GITHUB_ENV

      - name: Download packages
        uses: actions/download-artifact@v3

      - name: Publish archives and packages
        uses: softprops/action-gh-release@v1
        with:
          tag_name: ${{ env.version }}
          files: |
            mosh-x86_64.tar.gz
            mosh-aarch64.tar.gz
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

The tarballs don't appear in the release and the log ends with this:

2023-03-27T00:21:52.8210661Z 🤔 Pattern 'mosh-x86_64.tar.gz' does not match any files.
2023-03-27T00:21:52.8213299Z 🤔 Pattern 'mosh-aarch64.tar.gz' does not match any files.
2023-03-27T00:21:53.4174666Z 🤔 mosh-x86_64.tar.gz,mosh-aarch64.tar.gz not include valid file.

What am I doing wrong?

The problem is that when you upload an artifact like this :

        - uses: actions/upload-artifact@v3
          with:
            name: mosh.tar.gz
            path: mosh.tar.gz

and then download it with actions/download-artifact, the path to your tar.gz file will be name_you_give/name_of_your_file, so in your case mosh.tar.gz/mosh.tar.gz.

So you need to do this :

      - name: Publish archives and packages
        uses: softprops/action-gh-release@v1
        with:
          tag_name: ${{ env.version }}
          files: |
            mosh-x86_64.tar.gz/mosh-x86_64.tar.gz
            mosh-aarch64.tar.gz/mosh-aarch64.tar.gz
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Hope this resolve your problem @eggbean and @RalfJung.

Axteli avatar Apr 23 '23 12:04 Axteli

Oh I see, cargo-careful.exe is a directory in my ls... That is surely confusing (not your code of course). Thanks for the hint.

RalfJung avatar Apr 23 '23 13:04 RalfJung

I think I also get the same issue:

first files are uploaded :

- name: ↗️ upload artifact
   uses: actions/upload-artifact@v3
   with:
     name: mdbook-codeblocks-v${{ steps.tagName.outputs.version }}-${{ matrix.flavor.target }}.${{ matrix.flavor.ext }}
     path: mdbook-codeblocks-v${{ steps.tagName.outputs.version }}-${{ matrix.flavor.target }}.${{ matrix.flavor.ext }}
upload-artifact-job

then in a subsequent job they get downloaded to artifacts folder :

- name: ↙️ download artifacts
  uses: actions/download-artifact@v3
  with:
    path: artifacts
download-artifact-job

but weirdly, once creating the release it states that files pattern does not yield any result :

- name: 🔖 create GitHub release
  uses: softprops/action-gh-release@v1
  with:
    token: ${{ secrets.GITHUB_TOKEN }}
    name: v${{ steps.tagName.outputs.version }}
    files: |
      artifacts/mdbook-codeblocks-v${{ steps.tagName.outputs.version }}-aarch64-apple-darwin.tar.gz
      artifacts/mdbook-codeblocks-v${{ steps.tagName.outputs.version }}-x86_64-apple-darwin.tar.gz
      artifacts/mdbook-codeblocks-v${{ steps.tagName.outputs.version }}-x86_64-pc-windows-msvc.zip
      artifacts/mdbook-codeblocks-v${{ steps.tagName.outputs.version }}-x86_64-pc-windows-gnu.zip
      artifacts/mdbook-codeblocks-v${{ steps.tagName.outputs.version }}-x86_64-unknown-linux-gnu.tar.gz
      artifacts/mdbook-codeblocks-v${{ steps.tagName.outputs.version }}-x86_64-unknown-linux-musl.tar.gz
create-github-release-path

Roms1383 avatar Apr 24 '23 01:04 Roms1383

Tested this and it works fine. I think this bug report can be closed It's ugly but the full part actually works fine. I guess you can use a relative path too, but I have not tried it yet.

          uses: actions/upload-artifact@v2
          with:
            name: release-${{ matrix.model }}
            path: ${{ github.workspace }}/artifacts
    release-job:
      needs: build-job
      runs-on: ubuntu-latest
      steps:
        - name: Download packages
          uses: actions/download-artifact@v2
        - name: Get release version
          run: |
            echo "version=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
        - name: Publish archives and packages
          uses: softprops/action-gh-release@v1
          with:
            tag_name: ${{ env.version }}
            body: "This is a test"
            draft: true
            prerelease: true
            files: /home/runner/work/asuswrt-merlin.ng/asuswrt-merlin.ng/release*/*
          env:
            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

gnuton avatar Jan 25 '24 01:01 gnuton

I would say fail_on_unmatched_files should be on by default. Currently, when I have a typo or other issue in my files, it will be ignored and I have to go hunt the log file -- that's no very robust. Better fail loudly than silently do the wrong thing.

RalfJung avatar Jan 25 '24 06:01 RalfJung

I lterally can't get my release to match any files.

  • I've done the exact path to my download url
  • I've done only the folder with wildcard
  • I've done plain *.tar.gz

It's been well over 8 hours of trying on and off, is there any way I can ensure that this works?

I'm trying everything in this thread and nothing is working. I'll just keep bashing my head against the wall and see if I can get this working.

See the output below to see that the files actually exist.

insane-output

FilledStacks avatar Mar 01 '24 09:03 FilledStacks

Thanks everyone for this, got my head exploding to get this working. In the end, the 4.0k size should have made clear they are folders and not actual files, but who could have thought about that without an hint :D

image

nicolabeghin avatar Jun 03 '24 15:06 nicolabeghin