xresloader / upload-to-github-release

MIT License
52 stars 10 forks source link

Release already exists error #36

Closed csandanov closed 2 years ago

csandanov commented 2 years ago

Last time I run it it worked fine (Apr 2022).

This is my action:

    - name: release github
      if: startsWith(github.ref, 'refs/tags/')
      uses: xresloader/upload-to-github-release@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        file: dist/wodby-*.tar.gz
        overwrite: true
        tags: true
        draft: false
        tag_name: ${{ steps.version.outputs.VERSION }}

I get the following error:

Error: Try to create release 0.1.8 for wodby/wodby-cli failed: Validation Failed: {"resource":"Release","code":"already_exists","field":"tag_name"}

Full output:

Run xresloader/upload-to-github-release@v1
  with:
    file: dist/wodby-*.tar.gz
    overwrite: true
    tags: true
    draft: false
    tag_name: 0.1.8
    prerelease: false
    verbose: false
    update_latest_release: false
  env:
    VERSION: 0.1.8
    AWS_S3_BUCKET: ***
    AWS_ACCESS_KEY_ID: ***
    AWS_SECRET_ACCESS_KEY: ***
    SOURCE_DIR: dist
    GOOS: windows
    GOARCH: amd64
    GOROOT: /opt/hostedtoolcache/go/1.16.15/x64
    GITHUB_TOKEN: ***
File found to upload: dist/wodby-windows-amd64.tar.gz
Try to get release by tag 0.1.8 from wodby/wodby-cli
Try to get release by tag 0.1.8 from wodby/wodby-cli : Not Found
Try to get draft release 0.1.8 from wodby/wodby-cli
Try to create release 0.1.8 for wodby/wodby-cli
Try to create release 0.1.8 for wodby/wodby-cli failed: Validation Failed: {"resource":"Release","code":"already_exists","field":"tag_name"}
HttpError: Validation Failed: {"resource":"Release","code":"already_exists","field":"tag_name"}
    at /home/runner/work/_actions/xresloader/upload-to-github-release/v1/lib/index.js:461[2](https://github.com/wodby/wodby-cli/runs/7078163720?check_suite_focus=true#step:13:2):21
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async run (/home/runner/work/_actions/xresloader/upload-to-github-release/v1/lib/index.js:19684:1[3](https://github.com/wodby/wodby-cli/runs/7078163720?check_suite_focus=true#step:13:3))
Error: Try to create release 0.1.8 for wodby/wodby-cli failed: Validation Failed: {"resource":"Release","code":"already_exists","field":"tag_name"}
HttpError: Validation Failed: {"resource":"Release","code":"already_exists","field":"tag_name"}
    at /home/runner/work/_actions/xresloader/upload-to-github-release/v1/lib/index.js:[4](https://github.com/wodby/wodby-cli/runs/7078163720?check_suite_focus=true#step:13:4)612:21
    at processTicksAndRejections (node:internal/process/task_queues:96:[5](https://github.com/wodby/wodby-cli/runs/7078163720?check_suite_focus=true#step:13:5))
    at async run (/home/runner/work/_actions/xresloader/upload-to-github-release/v1/lib/index.js:19[6](https://github.com/wodby/wodby-cli/runs/7078163720?check_suite_focus=true#step:13:6)84:13)
Start uploading asset: dist/wodby-windows-amd64.tar.gz(size: 29554[7](https://github.com/wodby/wodby-cli/runs/7078163720?check_suite_focus=true#step:13:7)4) ...
Upload asset: wodby-windows-amd64.tar.gz success
owent commented 2 years ago

Please do not run xresloader/upload-to-github-release concurrenctly if you want to use it to create release. There may be more than one job try to create a new release when they both can not find a existed one. You can use create-release to create a release standalone, and set release_id of xresloader/upload-to-github-release to the output.id of create-release. Here is a example https://github.com/xresloader/upload-to-github-release-test/blob/cd729bbdb8b7183a3672afb81b040a0d76bcd6dc/.github/workflows/release.yml#L38 .

csandanov commented 2 years ago

Thank you! Reworked as you suggested. Creating release in a separate job now after the matrix jobs completed and then upload in a matrix again.