Skip to content
tag

GitHub Action

Update GitHub Release

v1.3.1 Latest version

Update GitHub Release

tag

Update GitHub Release

Update GitHub Release

Installation

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

              

- name: Update GitHub Release

uses: tubone24/[email protected]

Learn more about this action in tubone24/update_release

Choose a version

update_release (GitHub Release API)

Release Version Actions Status Coverage Status license standard-readme compliant PRs Welcome

This GitHub Action (written in JavaScript) is to change the Body Text and Name of an already created Release with using the GitHub Release API.

Table of Contents

Install

Pre-requisites

Create a workflow .yml file in your .github/workflows directory.

An example workflow is available below. For more information, reference the GitHub Help Documentation for Creating a workflow file.

Usage

Inputs

Change GitHub Releases, if you set the inputs.

  • release_name
    • If this item is set, the release name is overridden.
  • body
    • If this item is set, the body text is overridden.
  • draft
    • If this item is set, the draft is overridden.
  • prerelease
    • If this item is set, the prerelease is overridden.
  • is_append_body
    • If true, append body text on old one.
  • body_path
    • Path to file with new body text.

Outputs

Environment variables

  • GITHUB_TOKEN
    • The github auth token (mandatory)
  • TAG_NAME
    • The name of the tag a release is searched for. If not set context.ref will be used instead.

Example workflow - update a release

name: Release

on:
  release:
    types: [created]

jobs:
  build:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        include:
          - os: ubuntu-latest
            asset_name_suffix: ''
            asset_content_type: application/octet-stream
          - os: windows-latest
            asset_name_suffix: .exe
            asset_content_type: application/octet-stream
          - os: macOS-latest
            asset_name_suffix: ''
            asset_content_type: application/octet-stream
    steps:
      - uses: actions/checkout@v1
      - uses: tubone24/[email protected]
      - name: Install Dependencies
        run: nimble install -d --accept
      - name: Build
        run: nimble build -d:release
      - name: get version
        id: get_version
        run: |
          echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
      - name: update release
        id: update_release
        uses: tubone24/[email protected]
        env:
          GITHUB_TOKEN: ${{ github.token }}
        with:
          body: test_body # new body text
      - name: Upload Release Asset
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.github_token }}
        with:
          upload_url: ${{ steps.update_release.outputs.upload_url }}
          asset_path: ./bin/post_twitter_on_work${{ matrix.asset_name_suffix }}
          asset_name: post_twitter_on_work_${{ runner.os }}_${{ steps.get_version.outputs.VERSION }}${{ matrix.asset_name_suffix }}
          asset_content_type: ${{ matrix.asset_content_type }}

on-release-created is a event to create a release and you can get release id on the actions. Also changed body text.

This uses the GITHUB_TOKEN provided by the virtual environment, so no new token is needed.

Demos

See the repo:

https://github.com/tubone24/post_twitter_on_work

Test

If you modify this codes, run unit test with jest.

npm test

Also, this repo is integrated with GitHub Action.

So, Run CI test, if you write test.

Contributing

See the contributing file!

PRs accepted.

Small note: If editing the Readme, please conform to the standard-readme specification.

License

MIT © tubone.