mrcfps / github-release

Github Action to create, update, or add files to Github Releases

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

meeDamian/github-release

branches_gh_action_svg gh_last_release_svg tippin_svg

Github Action to create and update Github Releases, as well as upload assets to them.

Usage

See action.yml

Minimal

steps:
- uses: actions/checkout@v1

- uses: meeDamian/github-release@1.0
  with:
    token: ${{secrets.GITHUB_TOKEN}}

token is the only always required parameter to be passed to this action. Everything else can use sane defaults in some circumstances. See arguments to learn more.

Arguments

All inputs are available as a normal Action input, but because Github Actions don't accept shell variables there, some are also available as an Environment Variable set beforehand. When both set, one set as input takes precedence.

name ENV var alternative required description
token - always Github Access token. Can be accessed by using ${{secrets.GITHUB_TOKEN}} in the workflow file.
tag RELEASE_TAG sometimes If triggered by git tag push, tag is picked up automatically. Otherwise tag: has to be set. For tags constructed dynamically, use RELEASE_TAG env var.
commitish - no Commit hash this release should point to. Unnecessary, if tag is a git tag. Otherwise, current master is used. more
name RELEASE_NAME no Place to name the release, the more creative, the better. Defaults to the name of the tag used. more
body - no Place to put a longer description of the release, ex changelog, or info about contributors. Defaults to the commit message of the reference commit. more
draft - no Set to true to create a release, but not publish it. false by default. more
prerelease - no Marks this release as a pre-release. false by default. more
files RELEASE_FILES no A space-separated list of files to be uploaded. When left empty, no files are uploaded. More on files below
gzip - no Set whether to gzip uploaded assets, or not. Available options are: true, false, and folders which uploads files unchanged, but compresses directories/folders. Defaults to true. Note: it errors if set to false, and files: argument contains path to a directory.
allow_override - no Allow override of release, if one with the same tag already exists. Defaults to false

Using ENV vars

In a step before this action, run ex:

steps:
    ...
    - name: Set enviroment for github-release
      run: |
        echo ::set-env name=RELEASE_TAG::"v1.0.0"
        echo ::set-env name=RELEASE_NAME::"${GITHUB_WORKFLOW}"

    - uses: meeDamian/github-release@1.0
      with:
        token: ${{secrets.GITHUB_TOKEN}}
    ...

To learn more about notation used above see this.

Files syntax

In it's simplest form it takes a single file/folder to be compressed & uploaded:

with:
  
  files: release/

Each uploaded element can also be named by prefixing the path to it with: <name>:, example:

with:
  
  files: release-v1.0.0:release/

As of Aug 2019, Github Actions doesn't support list arguments to actions, so to pass multiple files, pass them as a space-separated string. To do that in an easier to read way, YAML multiline syntax can be used, example:

with:
  
  files: >
    release-v1.0.0-linux:release/linux/
    release-v1.0.0-mac:release/darwin/
    release-v1.0.0-windows:release/not-supported-notice
    checksums.txt      

Advanced example

steps:
- uses: actions/checkout@master

- uses: meeDamian/github-release@0.1
  with:
    token: ${{ secrets.GITHUB_TOKEN }}
    tag: v1.3.6
    name: My Creative Name
    body: >
      This release actually changes the fabric of the reality, so be careful 
      while applying, as error in database migration, can irrecoverably wipe 
      some laws of physics.  
    gzip: folders
    files: >
      Dockerfile
      action.yml
     .github/
      license:LICENSE
      work-flows:.github/

Versioning

As of Aug 2019, Github Actions doesn't natively understand shortened tags in uses: directive.

To go around that and not do what git-tag-manual calls "The insane thing", I'm creating permanent git tags for each release in a semver format prefixed with v, as well as maintain branches with shortened tags. You can see the exact process here.

Ex. 1.4 branch always points to the newest v1.4.x tag, etc.

In practice:

# For exact version
steps:
  uses: meeDamian/github-release@v1.0.1

Or

# For newest minor version 1.0
steps:
  uses: meeDamian/github-release@1.0

Note: It's likely branches will be deprecated once Github Actions fixes its limitation.

License

The scripts and documentation in this project are released under the MIT License

About

Github Action to create, update, or add files to Github Releases

License:MIT License


Languages

Language:Shell 98.4%Language:Dockerfile 1.6%