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

Return the upload url in the outputs #426

Closed
jcornaz opened this issue Jan 31, 2022 · 5 comments · Fixed by #437
Closed

Return the upload url in the outputs #426

jcornaz opened this issue Jan 31, 2022 · 5 comments · Fixed by #437

Comments

@jcornaz
Copy link
Contributor

jcornaz commented Jan 31, 2022

TL;DR

When releasing an application (not a library), it is common to upload the binaries to the github release. There is even an action do to it easily: https://github.com/actions/upload-release-asset.

But to upload to a github release, we need the "upload_url" which is returned when the release is created.

release-please could set that uload url in the outputs so we can write upload the artifacts to the release created by release-please.

Detailed design

Possible example of usage:

name: release
on:
  push:
    branches:
      - main
jobs:
  release:
    runs-on: ubuntu-latest
    outputs:
      release_created: ${{ steps.release.outputs.release_created }}
      upload_url: ${{ steps.release.outputs.upload_url }}
    steps:
      - uses: google-github-actions/release-please-action@v3.1
        id: release
        with:
          release-type: rust

  upload-artifacts:
    needs: release
    runs-on: ubuntu-latest
    if: needs.release.outputs.release_created
    steps:
      - uses: actions/checkout@v2.4.0
      - uses: actions-rs/toolchain@v1.0.7
        with:
          toolchain: stable
      - run: cargo build --release
      - uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          # Get the upload url from release-please outputs
          upload_url: ${{ needs.release.outputs.upload_url }} 
          asset_path: ./target/release/my-artifact

Additional information

No response

@jcornaz
Copy link
Contributor Author

jcornaz commented Jan 31, 2022

Sorry. I don't know why I didn't see it was already there....

@jcornaz jcornaz closed this as completed Jan 31, 2022
@brad-jones
Copy link

Perhaps the reason you missed it is because it isn't returned? I thought I'd give release-please a go over semantic-release but have been debugging why my upload action isn't working. The upload_url simply is not returned in the actions outputs.

image

@jcornaz
Copy link
Contributor Author

jcornaz commented Feb 2, 2022

Ah... maybe indeed.

@jcornaz jcornaz reopened this Feb 2, 2022
@axieum
Copy link

axieum commented Feb 2, 2022

Check my comment here, maybe it will help you 😊

https://github.com/google-github-actions/release-please-action/issues/400#issuecomment-1025264971

@jcornaz
Copy link
Contributor Author

jcornaz commented Feb 2, 2022

Thanks @axieum. Indeed with some tools we can use the tag_name instead of the upload url (I think that would also work with softprops/action-gh-release)

Remains open the question of what to do to fix this issue. We could either:

  • Update the readme to remove upload_url from the list of output, as it is in fact not in the outputs, but also may not be necessary as we should be able to use the tag_name instead.
  • Fix the behavior to produce the upload_url so that it matches the documentation.

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

Successfully merging a pull request may close this issue.

3 participants