Skip to content
upload-cloud

GitHub Action

Publish Release

v1.0.6 Latest version

Publish Release

upload-cloud

Publish Release

A GitHub Action to publish a draft release

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Publish Release

uses: eregon/publish-release@v1.0.6

Learn more about this action in eregon/publish-release

Choose a version

publish-release

A GitHub Action to publish a draft release.

actions/create-release can create a draft release, and then actions/upload-release-asset can upload builds and finally this action can publish the release.

This has the advantage that the latest release link (https://github.com/owner/repo/releases/latest) always points to a fully-built release.

Note that the release must not be marked as prerelease for this to work.

This also means it's possible to have a stable URL for a release asset which always has the same filename: https://github.com/owner/repo/releases/latest/download/asset-filename.tar.gz

Those URLs are documented in GitHub Help.

Minimal example workflow:

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
    - name: Create Draft Release
      id: create_release
      uses: actions/create-release@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        tag_name: <tofill>
        release_name: <tofill>
        draft: true
        prerelease: false

    - uses: actions/upload-release-asset@v1.0.1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        upload_url: ${{ steps.create_release.outputs.upload_url }}
        asset_path: ./my-artifact.zip
        asset_name: my-artifact.zip
        asset_content_type: application/zip

    - uses: eregon/publish-release@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        release_id: ${{ steps.create_release.outputs.id }}

Alternative: gh

Unfortunately, both actions/create-release and actions/upload-release-asset are archived and using an outdated node version. A good alternative is to use the gh CLI tool available in GitHub Actions, like here.