Skip to content

Return the upload url in the outputs #426

@jcornaz

Description

@jcornaz

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions