gitout icon indicating copy to clipboard operation
gitout copied to clipboard

Upload binaries into releases from tags

Open JakeWharton opened this issue 5 years ago • 5 comments

Figure out what's needed and how to upload which is built on all commits but only uploaded on tags

JakeWharton avatar May 18 '20 03:05 JakeWharton

Thanks! I had been looking at ripgrep.

On Sat, May 23, 2020, at 11:24 AM, Khải wrote:

I use GitHub Workflow to deploy everything: upload binaries to release page, publish cargo crate, update AUR packages, publish npm packages, you might want to take a look. https://github.com/KSXGitHub/sane-fmt/blob/d4efb43d43005dee6a2068a1e47509e28c9b284c/.github/workflows/deploy.yaml

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JakeWharton/gitout/issues/8#issuecomment-633075465, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAQIENLJDS3NUEDGZDQKVLRS7TBZANCNFSM4NDWWDFQ.

JakeWharton avatar May 23 '20 18:05 JakeWharton

but only uploaded on tags

Is this the hard part for you?

GitHub Actions has an input/output mechanism. You may feed ${{ github.ref }} as an environment variable into a script you created, that script would then determine if it is a release and set corresponding output, the step that creates release and uploads release binaries would have a condition (e.g. if: steps.release_type.outputs.is_release == 'true'). As an example, line 363-404 of my workflow contains all the steps.

KSXGitHub avatar May 24 '20 02:05 KSXGitHub

Nope. We already have tag-based releases to Docker and Crates.io.

It's just a matter of building the necessary binaries and uploading them in that workflow.

JakeWharton avatar May 24 '20 02:05 JakeWharton

It's just a matter of building the necessary binaries and uploading them in that workflow.

Then I guess the hard part is sending build artifact from build jobs to jobs that create release?

You may use actions/upload-artifact in build jobs to upload built artifacts and actions/download-artifact to download built artifacts in jobs that upload release binaries.

My workflow has that too. It builds and releases for multiple targets in multiple platform so I have to divide it into multiple jobs:

  • build_linux, build_macos, and build_windows build release binaries and upload them as shared artifacts.
  • create_release (must be executed only once, so no matrix) that creates a release.
  • upload_release_assets that downloads shared artifacts and uploads them to GitHub Release according to strategy.matrix.target.

KSXGitHub avatar May 24 '20 02:05 KSXGitHub