Skip to content

eregon/publish-release

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.