actions / upload-release-asset

An Action to upload a release asset via the GitHub Release API
MIT License
683 stars 185 forks source link

[error]Not Found #20

Open kdefives opened 4 years ago

kdefives commented 4 years ago

Hello,

I have the error message when i try to upload a file to my release assets (see below). In the step name "Build" i am sure the ZIP file exists on ./build because the result of the "ls" command display the ZIP file in the console. This confirm that the ZIP is correctly created in ./build

Upload Release Asset
Run actions/upload-release-asset@v1.0.1
with:
    upload_url: https://uploads.github.com/repos/XXXX/terraform-provider-YYYY/releases/v0.0.1/assets{?name,label}
    asset_path: ./build/terraform-provider-YYYY.zip
    asset_name: terraform-provider-YYYY.zip
    asset_content_type: application/zip
  env:
    GOROOT: /opt/hostedtoolcache/go/1.12.13/x64
    GITHUB_TOKEN: ***
##[error]Not Found
##[error]Node run failed with exit code 1

And below you will find by workflow source code. Anyway, I don't know if this could be the root cause of my problem but my repository "XXXX" is a private repository.

name: Test Build and Publish (release creation)

on:
  push:
    tags:
      - '*'

jobs:

  build:
    name: Build and publish
    runs-on: ubuntu-latest 
    steps:
      - name: Set up Go
        uses: actions/setup-go@v1
        with:
          go-version: 1.12

      - name: Check out code
        uses: actions/checkout@v1
        id: check_out_code

      - name: Set output
        id: vars
        run: echo ::set-output name=tag::${GITHUB_REF/refs\/tags\//}

      - name: Build
        run: |
          git config --global url."https://${{ secrets.SecretGithubToken }}:x-oauth-basic@github.com/".insteadOf "https://github.com/"
          go get -u github.com/hashicorp/terraform
          go get -u github.com/XXXX/terraform-provider-YYYY
          make build-github
          zip -r ./build/terraform-provider-YYYY.zip ./build/terraform-provider-YYYY
          ls ./build

      - name: Upload Release Asset
        id: upload-release-asset 
        uses: actions/upload-release-asset@v1.0.1
        env:
          GITHUB_TOKEN: ${{ secrets.SecretGithubToken }}
        with:
          upload_url: https://uploads.github.com/repos/XXXX/terraform-provider-YYYY/releases/${{ steps.vars.outputs.tag }}/assets{?name,label}
          asset_path: ./build/terraform-provider-YYYY.zip
          asset_name: terraform-provider-YYYY.zip
          asset_content_type: application/zip

Please can you help me to solve this issue? :)

Thanks in advance! Regards

AndreasBrostrom commented 4 years ago

Having the same issue this is my snippet of the upload yml:

    # ...SNIP...
      - name: Upload Release cScripts
        id: upload-release-asset 
        uses: actions/upload-release-asset@v1.0.1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: https://uploads.github.com/repos/ColdEvul/cScripts/releases/${{ steps.get_version.outputs.VERSION }}/assets?name=cScripts-${{ steps.get_version.outputs.VERSION }}.zip
          asset_path: release/cScripts-${{ steps.get_version.outputs.VERSION }}.zip
          asset_name: cScripts-${{ steps.get_version.outputs.VERSION }}.zip
          asset_content_type: application/zip
    # ...SNIP...

And log snippet also containing the build output of a successful assembly (with typos).

Run ./tools/deploy.sh 4.1.11
Preparing a release build for cScripts
  Version: 4.1.11
  Branch:  HEAD
  Hash:    b6caafd

Found Objects:
Data, cScripts, README.md, init.sqf, cba_settings.sqf, initServer.sqf, description.ext

Starting build copying for 4.1.11...
Featching directorys and files from Data...
Featching directorys and files from cScripts...
Featching files README.md...
Featching files init.sqf...
Featching files cba_settings.sqf...
Featching files initServer.sqf...
Featching files description.ext...
Creating version dummy file...
Building archive...
Archive created you can find it in the release folder. (release/cScripts-4.1.11.zip)
Build complet.

Run actions/upload-release-asset@v1.0.1
  with:
    upload_url: https://uploads.github.com/repos/ColdEvul/cScripts/releases/4.1.11/assets?name=cScripts-4.1.11.zip
    asset_path: release/cScripts-4.1.11.zip
    asset_name: cScripts-4.1.11.zip
    asset_content_type: application/zip
  env:
    GITHUB_TOKEN: ***
##[error]Not Found
##[error]Node run failed with exit code 1
kdefives commented 4 years ago

Having the same issue this is my snippet of the upload yml:

    # ...SNIP...
      - name: Upload Release cScripts
        id: upload-release-asset 
        uses: actions/upload-release-asset@v1.0.1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: https://uploads.github.com/repos/ColdEvul/cScripts/releases/${{ steps.get_version.outputs.VERSION }}/assets?name=cScripts-${{ steps.get_version.outputs.VERSION }}.zip
          asset_path: release/cScripts-${{ steps.get_version.outputs.VERSION }}.zip
          asset_name: cScripts-${{ steps.get_version.outputs.VERSION }}.zip
          asset_content_type: application/zip
    # ...SNIP...

And log snippet also containing the build output of a successful assembly (with typos).

Run ./tools/deploy.sh 4.1.11
Preparing a release build for cScripts
  Version: 4.1.11
  Branch:  HEAD
  Hash:    b6caafd

Found Objects:
Data, cScripts, README.md, init.sqf, cba_settings.sqf, initServer.sqf, description.ext

Starting build copying for 4.1.11...
Featching directorys and files from Data...
Featching directorys and files from cScripts...
Featching files README.md...
Featching files init.sqf...
Featching files cba_settings.sqf...
Featching files initServer.sqf...
Featching files description.ext...
Creating version dummy file...
Building archive...
Archive created you can find it in the release folder. (release/cScripts-4.1.11.zip)
Build complet.

Run actions/upload-release-asset@v1.0.1
  with:
    upload_url: https://uploads.github.com/repos/ColdEvul/cScripts/releases/4.1.11/assets?name=cScripts-4.1.11.zip
    asset_path: release/cScripts-4.1.11.zip
    asset_name: cScripts-4.1.11.zip
    asset_content_type: application/zip
  env:
    GITHUB_TOKEN: ***
##[error]Not Found
##[error]Node run failed with exit code 1

I think i found the rootcause :

upload_url: https://uploads.github.com/repos/XXXX/terraform-provider-YYYY/releases/${{ steps.vars.outputs.tag }}/assets{?name,label}

I am not 100% sure, but here potential rootcause: Here "${{ steps.vars.outputs.tag }}" should not be the tag name but the unique ID of the tag. You can find it by using GitHub API.

On my side, as i am using GO binaries, i am using this to solve my issue:

- name: Create release on GitHub
        uses: goreleaser/goreleaser-action@v1
        with:
          args: release
        env:
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
RobotLivermore commented 4 years ago

I met the same situation and found that I had made mistake with upload_url. The upload_url should be like this,:

POST https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets?name=foo.zip

that after release is release_id rather than tag.

This is my upload_url:

https://uploads.github.com/repos/BohengLiu/action_demo/releases/22947439/assets{?name,label}

I hope it helpful for you!