taiki-e / upload-rust-binary-action

GitHub Action for building and uploading Rust binary to GitHub Releases.
Apache License 2.0
246 stars 22 forks source link

`stat $: no such file or directory` when attempting first release #78

Closed cr1901 closed 6 months ago

cr1901 commented 6 months ago

I'm trying to use upload-rust-binary-action to upload my first release of a small CLI/GUI app and can't seem to make it succeed no matter what I do. Given my release.yml so far:

name: Release

permissions:
  contents: write

on:
  push:
    tags:
      - v[0-9]+.*

jobs:
  create-release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: taiki-e/create-gh-release-action@v1
        with:
          draft: true
          changelog: CHANGELOG.md
          token: ${{ secrets.GITHUB_TOKEN }}

  upload-assets:
    needs: create-release
    strategy:
      matrix:
        target: [aarch64-apple-darwin, x86_64-apple-darwin,
                 x86_64-unknown-linux-gnu, x86_64-pc-windows-msvc]
        include:
            - target: aarch64-apple-darwin
              os: macos-latest
            - target: x86_64-apple-darwin
              os: macos-latest
            - target: x86_64-unknown-linux-gnu
              os: ubuntu-latest
            - target: x86_64-pc-windows-msvc
              os: windows-latest
              assets: target/wix/swmon-${{github.ref_name}}-x86_64.msi
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
      - name: Install packages (Linux)
        if: ${{ runner.os == 'Linux' && !matrix.apt-arch }}
        run: sudo apt-get update && sudo apt-get install libudev-dev
      - name: Install MSI (Windows)
        if: runner.os == 'Windows'
        run: |
            cargo install cargo-wix
            cargo wix -o target/wix/swmon-${{github.ref_name}}-x86_64.msi
      - uses: taiki-e/upload-rust-binary-action@v1
        with:
          # (required) Comma-separated list of binary names (non-extension portion of filename) to build and upload.
          # Note that glob pattern is not supported yet.
          bin: swmon,swmon-gui
          include: LICENSE.md,README.md,assets/swmon-gui_k8Sy5hg15P.png
          # (optional) Target triple, default is host triple.
          target: ${{ matrix.target }}
          tar: unix
          zip: windows
          archive: swmon-$target
          leading-dir: true
          asset: $${{ matrix.assets || '' }}
          # (required) GitHub token for uploading assets to GitHub Releases.
          token: ${{ secrets.GITHUB_TOKEN }}

The build consistently fails with:

stat $: no such file or directory
stat $: no such file or directory
stat $: no such file or directory
stat $: no such file or directory
stat $: no such file or directory
stat $: no such file or directory
stat $: no such file or directory
stat $: no such file or directory
stat $: no such file or directory
stat $: no such file or directory
stat $: no such file or directory

Eventually the build times out and fails. What am I doing wrong? Even if this is user error, is it possible to improve the error message to explain what I'm doing wrong?

taiki-e commented 6 months ago

asset: $${{ matrix.assets || '' }}

This is treated as file name $ when matrix.assets is not set. You have to use ${{ matrix.assets || '' }} instead of $${{ matrix.assets || '' }}

taiki-e commented 6 months ago

FYI, here is the expanded log of the failed job (https://github.com/cr1901/swmon/actions/runs/9248472961/job/25438823984#step:5:10). (asset is set to $.)

log
taiki-e commented 6 months ago

is it possible to improve the error message to explain what I'm doing wrong?

In this case, it would probably be to check beforehand whether the path passed in asset or include is existent, but it might be okay to simply output the command to be executed.

cr1901 commented 6 months ago

I am about all CI-'ed out tonight... anyways that change worked. CI is now green, thanks for the help :D: https://github.com/cr1901/swmon/actions/runs/9249016102