Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to avoid 404 Not Found [] #113

Open
jqk opened this issue Feb 17, 2023 · 12 comments
Open

how to avoid 404 Not Found [] #113

jqk opened this issue Feb 17, 2023 · 12 comments

Comments

@jqk
Copy link

jqk commented Feb 17, 2023

你好!

我尝试将 go 程序发布,以下为 watch.yml

name: TestWatch

on:
  workflow_dispatch

jobs:
  releases-scoop:
    name: Release scoop cache cleaner binary
    runs-on: ubuntu-latest
    strategy:
      matrix:
        # build and publish in parallel: windows/amd64, windows/arm64
        goos: [ windows ]
        goarch: [ amd64 ]
    steps:
      - uses: actions/checkout@v3
      - uses: wangyoucao577/[email protected]
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          goos: ${{ matrix.goos }}
          goarch: ${{ matrix.goarch }}
          binary_name: "scc"
          extra_files: readme-zh.md readme.md

前面的步骤运行正常,但最终得到如下结果:

...
+ zip -vr scc-master-windows-amd64.zip readme-zh.md readme.md scc.exe
  adding: readme-zh.md	(in=1551) (out=990) (deflated 36%)
  adding: readme.md	(in=1157) (out=637) (deflated 45%)
  adding: scc.exe 	(in=2806272) (out=1669583) (deflated 41%)
total bytes=2808980, compressed=1671210 -> 41% savings
++ md5sum scc-master-windows-amd64.zip
++ cut -d ' ' -f 1
+ MD5_SUM=8c77a15f9ba8c74a[237](https://github.com/jqk/scoop-cache-cleaner/actions/runs/4200234458/jobs/7286043285#step:4:237)354e9f2736601
++ sha256sum scc-master-windows-amd64.zip
++ cut -d ' ' -f 1
+ SHA256_SUM=4b184c02a31b02af23dc24f5eb9647a5aeeb1333826aec60369c55b17643a345
+ GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS=
+ '[' FALSE == TRUE ']'
+ github-assets-uploader -logtostderr -f scc-master-windows-amd64.zip -mediatype application/zip -repo jqk/scoop-cache-cleaner -token *** -tag=master -releasename= -retry 3
W0217 02:56:04.191566     540 main.go:58] Upload asset error, will retry in 3s: GET https://api.github.com/repos/jqk/scoop-cache-cleaner/releases/tags/master: 404 Not Found []
W0217 02:56:07.307118     540 main.go:58] Upload asset error, will retry in 3s: GET https://api.github.com/repos/jqk/scoop-cache-cleaner/releases/tags/master: 404 Not Found []
E0217 02:56:10.454726     540 main.go:21] GET https://api.github.com/repos/jqk/scoop-cache-cleaner/releases/tags/master: 404 Not Found []

无论是直接运行,还是打完个 v1.0.7 之类的 tag 再运行,都得到以上的 404 错误。

请问我这里需要设计什么吗?

谢谢!

@DameDrewby
Copy link

Typically the configuration is used with;

on:
  release:
    types: [created]

Then when you create a release in your repo this action will run against that release with the identification you gave it and it won't go to https://api.github.com/repos/jqk/scoop-cache-cleaner/releases/tags/master but instead it will go to https://api.github.com/repos/jqk/scoop-cache-cleaner/releases/tags/v1.0.0 (or whatever you called your release in the previous step)

@ehvs
Copy link

ehvs commented Jul 20, 2023

I am having this issue, even tho I have the same configuration:

on:
  workflow_dispatch:
  release:
    types: [created]

Logs

+ GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS=
+ '[' FALSE == TRUE ']'
+ github-assets-uploader -logtostderr -f oc-hc-main-linux-amd64.tar.gz -mediatype application/gzip -repo ehvs/openshift-cluster-health-check -token *** -tag=main -releasename= -retry 3
W0720 12:20:27.440875    3998 main.go:58] Upload asset error, will retry in 3s: GET https://api.github.com/repos/ehvs/openshift-cluster-health-check/releases/tags/main: 404 Not Found []
W0720 12:20:30.544231    3998 main.go:58] Upload asset error, will retry in 3s: GET https://api.github.com/repos/ehvs/openshift-cluster-health-check/releases/tags/main: 404 Not Found []
E0720 12:20:33.621688    3998 main.go:21] GET https://api.github.com/repos/ehvs/openshift-cluster-health-check/releases/tags/main: 404 Not Found []

Steps taken

  • Enabled Write to all directories in Settings

A detail, I do have a PAT for my account. Not sure tho if is relevant
Any insights?

@SentriumJames
Copy link

I am having this issue, even tho I have the same configuration:

on:
  workflow_dispatch:
  release:
    types: [created]

Have you tried without workflow_dispatch?

on:
  release:
    types: [created]

The error is saying it can't find anything at https://api.github.com/repos/ehvs/openshift-cluster-health-check/releases/tags/main because there is nothing there. You have a release called 'h1'

https://api.github.com/repos/ehvs/openshift-cluster-health-check/releases/tags/h1

@ehvs
Copy link

ehvs commented Jul 20, 2023

Hi @SentriumJames I think I am missing on how Actions and workflows works.
From where the workflow gets the URL? how can I redirect in a place?
My only goal here is to have my code released in the binaries.

BTW, I have just removed the workflow_dispatch from the workflow file, but once doing it, I cannot trigger manually the workflow to run. Tried by creating a new commit in both code and in the REleases, but the workflow does not run anymore. Im sure Im missing something basic here, but im not familiar with this function.

@SentriumJames
Copy link

The action (go release action) will run once you create a new release tag in your repository. So this is what it's waiting for, so for example, if you create a release tag called 1.0, then the action will create it's binaries from the code in that release tag. There is no need to redirect it or give it the URL, it knows where to go based off the release tag.

In my project it works just like this, but I use a slightly older version of the action (1.3.5 and you use 1.3.8) but I doubt this changes much.

Have you tried to create a new release tag to see if it will build your binaries successfully?

@ehvs
Copy link

ehvs commented Jul 20, 2023

That completely made the trick :D Thank you!
I wonder tho, all this trouble was because of the workflow_dispatch ?

@SentriumJames
Copy link

I don't know enough about workflow_dispatch but if it triggers the go release action but it causes it to look for a tag called "main" every time then this will cause the problem you had. But this is just speculation on my part.

Glad it works now though 👍

@huerni
Copy link

huerni commented Jul 30, 2023

on:
  push:
    tags:
      - "test/*"
jobs:
  releases-matrix:
    name: Release test binary
    runs-on: ubuntu-latest
    strategy:
      matrix:
        goos: [ linux, windows, darwin ]
        goarch: [ "386", amd64, arm64 ]
        exclude:
          - goarch: "386"
            goos: darwin
    steps:
      - uses: actions/checkout@v3
      - uses: wangyoucao577/go-zero-release-action@master
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          goos: ${{ matrix.goos }}
          goarch: ${{ matrix.goarch }}
          goversion: "1.20"
          project_path: "test"
          binary_name: "test"

After pushing the tag test/v1.0, I received the error: GET https://api.github.com/repos/huerni/gmitex/releases/tags/test/v1.0: 404 Not Found []. Why is this happening?

@DameDrewby
Copy link

on:
  push:
    tags:
      - "test/*"
jobs:
  releases-matrix:
    name: Release test binary
    runs-on: ubuntu-latest
    strategy:
      matrix:
        goos: [ linux, windows, darwin ]
        goarch: [ "386", amd64, arm64 ]
        exclude:
          - goarch: "386"
            goos: darwin
    steps:
      - uses: actions/checkout@v3
      - uses: wangyoucao577/go-zero-release-action@master
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          goos: ${{ matrix.goos }}
          goarch: ${{ matrix.goarch }}
          goversion: "1.20"
          project_path: "test"
          binary_name: "test"

After pushing the tag test/v1.0, I received the error: GET https://api.github.com/repos/huerni/gmitex/releases/tags/test/v1.0: 404 Not Found []. Why is this happening?

See my comment above.

on: release: types: [created]

This is the trigger you need to use. Then when you make changes to your code, create a new release and the go action will run.

@huerni
Copy link

huerni commented Jul 30, 2023

If I want it to be created automatically when pushing a tag, do I add this sentence?

@DameDrewby
Copy link

If I want it to be created automatically when pushing a tag, do I add this sentence?

Yep, replace on push with that. As I say, the example above I gave before should be all you need 🙂

@huerni
Copy link

huerni commented Aug 2, 2023

If I want it to be created automatically when pushing a tag, do I add this sentence?

Yep, replace on push with that. As I say, the example above I gave before should be all you need 🙂

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants