Giter Site home page Giter Site logo

create-release's Introduction

GitHub Action - Releases API

Please note: This repository is currently unmaintained by a team of developers at GitHub. The repository is here and you can use it as an example, or in Actions. However please be aware that we are not going to be updating issues or pull requests on this repository.

Maintained Actions:

To reflect this state we’ve marked this repository as Archived.

If you are having an issue or question about GitHub Actions then please contact customer support.

If you have found a security issue please submit it here.


This GitHub Action (written in JavaScript) wraps the GitHub Release API, specifically the Create a Release endpoint, to allow you to leverage GitHub Actions to create releases.

GitHub Actions status

Usage

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.

Inputs

For more information on these inputs, see the API Documentation

  • tag_name: The name of the tag for this release
  • release_name: The name of the release
  • body: Text describing the contents of the release. Optional, and not needed if using body_path.
  • body_path: A file with contents describing the release. Optional, and not needed if using body.
  • draft: true to create a draft (unpublished) release, false to create a published one. Default: false
  • prerelease: true to identify the release as a prerelease. false to identify the release as a full release. Default: false
  • commitish : Any branch or commit SHA the Git tag is created from, unused if the Git tag already exists. Default: SHA of current commit
  • owner: The name of the owner of the repo. Used to identify the owner of the repository. Used when cutting releases for external repositories. Default: Current owner
  • repo: The name of the repository. Used to identify the repository on which to release. Used when cutting releases for external repositories. Default: Current repository

body_path

The body_path is valuable for dynamically creating a .md within code commits and even within the Github Action steps leading up to the create-release.

Outputs

For more information on these outputs, see the API Documentation for an example of what these outputs look like

  • id: The release ID
  • html_url: The URL users can navigate to in order to view the release. i.e. https://github.com/octocat/Hello-World/releases/v1.0.0
  • upload_url: The URL for uploading assets to the release, which could be used by GitHub Actions for additional uses, for example the @actions/upload-release-asset GitHub Action

Example workflow - create a release

On every push to a tag matching the pattern v*, create a release:

on:
  push:
    # Sequence of patterns matched against refs/tags
    tags:
      - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Create Release

jobs:
  build:
    name: Create Release
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Create Release
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
        with:
          tag_name: ${{ github.ref }}
          release_name: Release ${{ github.ref }}
          body: |
            Changes in this Release
            - First Change
            - Second Change
          draft: false
          prerelease: false

This will create a Release, as well as a release event, which could be handled by a third party service, or by GitHub Actions for additional uses, for example the @actions/upload-release-asset GitHub Action. This uses the GITHUB_TOKEN provided by the virtual environment, so no new token is needed.

Contributing

We would love you to contribute to @actions/create-release, pull requests are welcome! Please see the CONTRIBUTING.md for more information.

License

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

create-release's People

Contributors

bilge avatar csexton avatar dependabot[bot] avatar ericsciple avatar ethomson avatar fleskesvor avatar francisfuzz avatar iamhughes avatar jbolda avatar jclem avatar jhutchings1 avatar khitrenovich avatar mscoutermarsh avatar pjquirk avatar sclaire-1 avatar thboop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

create-release's Issues

[Feature] Add release body templated from changelog

Firstly, it's really a great action! but it could be better.
For now create-release body only support plain text, but more of repository have file mark the latest commit after last release, such as CHANGELOG.md, I think it's awesome when we support read some file as templated and to create release body. I think a while, maybe we could support two way.

  • One is render the whole file pass to parameter, which should provide the file type, like below
  body_render_type:  markdown # rst and markdown support 
  body_render_path:  ./CHANGELOG.md
  • Other is render the specific section in the file, which should provide the file type, like below
  body_render_type:  markdown # rst and markdown support 
  body_render_path:  ./CHANGELOG.md
  body_render_section:  section you want to release here

I think it would useful, at least in my situation, wait for others opinion.

Feature request: include tag_name in outputs

Hi there,

i would like to include the release version in the 'Release Asset'.
This requires the value of ${{ github.ref }} without the 'refs/tags/' prefix.

According to the API Documentation the version will be returned in the field tag_name.

${{ steps.create_release.outputs.tag_name }}

Currently outputs is limited to id, html_url and upload_url.

Example use case:



- name: Upload Release Asset
      id: upload-release-asset 
      uses: actions/[email protected]
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        upload_url: ${{ steps.create_release.outputs.upload_url }}        
        asset_path: ./build/distributions/myapp-${{ steps.create_release.outputs.tag_name }}-bin.zip
        asset_name: myapp-${{ steps.create_release.outputs.tag_name }}-bin.zip
        # example:  asset_name: myapp-v1.0.2-bin.zip    
        asset_content_type: application/zip

Feature request: Allow updating existing release

I have previously used a workflow where each build updates a draft release. This is especially important when running builds for Linux, Windows and Mac.

Running this script now, will result in 3 individual draft releases, making it not work with projects that is multi-platform. At least not without running some other script to check if the release already exists or not.

Updating an published release is not possible, I'm asking about draft here.

Body value is not visible

So when I set a value for the body of the release, like here for example using 'Testing' as the body:

image

The string ('Testing') simply does not show up:

image

##[error]Validation Failed Why does this error happen?

This my workflow yaml. I think there is no error. But it always fails. Someone can help me ? Thanks.
图片

# on:
#   watch:
#     types: [started]
on: push
name: Upload Release Asset

jobs:
  build:
    name: Upload Release Asset
    runs-on: ubuntu-latest
    steps:
      - uses: uraimo/[email protected]
        id: runcmd
        with:
          architecture: aarch64
          distribution: ubuntu18.04
          run: |
            echo ::set-env name=ARCH::$(uname -m)
            echo ::set-output name=ARCH::$(uname -m)
            echo ::set-env name=TIME::$(date)
            ARCH=$(uname -m)
            echo "arch:::",$ARCH
            echo "123" >> ${ARCH}.zip
            echo `ls`
            echo `pwd`
      - name: test
        run: |
          echo ${TIME}
          echo "456" > ${ARCH}a.zip
          echo `uname -a`
          echo `pwd`
          echo `ls`
          echo ${ARCH}
      - name: Create Release
        id: create_release
        uses: actions/[email protected]
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          ARCH: ${{ env.ARCH }}
        with:
          tag_name: ${{ github.sha }}
          release_name: Release ${{ github.sha }}
          draft: false
          prerelease: false
      - name: Upload Release Asset
        id: upload-release-asset 
        uses: actions/[email protected]
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          ARCH: ${{ env.ARCH }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }}
          asset_path: ${ARCH}.zip
          asset_name: ${ARCH}.zip
          asset_content_type: application/zip

outputs not set

from job console:

Run actions/[email protected]
  with:
    asset_path: ./release.zip
    asset_name: release-.zip
    asset_content_type: application/zip
  env:
    RELEASE_VERSION: v0.0.22
    GITHUB_TOKEN: ***
##[error]Input required and not supplied: upload_url

workflow

    - name: Create a Release
      id: create_release
      uses: actions/create-release@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        tag_name: ${{ env.RELEASE_VERSION }}
        release_name: Pre Release - ${{ env.RELEASE_VERSION }}
        draft: false
        prerelease: true
    - name: Upload a Release Asset
      uses: actions/[email protected]
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        upload_url: ${{ steps.create_release.outputs.upload_url }}
        asset_path: ./release.zip
        asset_name: release-${{ steps.create_release.outputs.id }}.zip
        asset_content_type: application/zip

Why isn't the token taken as an input with a default?

I am curious why the token 1) is taken as an environment variable instead of an input, and 2) not defaulted to ${{ github.token }}, which seems to be the idiom on most other actions, especially the official ones. If it's just for legacy/compatibility reasons, totally understandable. Just checking if I am missing something here and if there are some semantic differences that I am missing.

Error reporting could be improved

I looked at the code for this action, but I'm not great with the javascript, so not sure I can fix it myself.

When I use this action in one of my workflows and the action receives an error from the github API, it doesn't bubble enough info from the API.

f.ex.

Create Release
Run actions/[email protected]
with:
  tag_name: 7e80c809f34b653a75d675520a69e3295861f68a
  release_name: Release 7e80c809f34b653a75d675520a69e3295861f68a
  draft: false
  prerelease: false
env:
  GOROOT: /opt/hostedtoolcache/go/1.12.10/x64
  GITHUB_TOKEN: ***
##[error]Validation Failed
##[error]Node run failed with exit code 1

From what I can tell the API should be returning an HTTP status code along with a JSON body that has more info like so

422 Validation Failed [{Resource:Release Field:target_commitish Code:invalid Message:}]

It would be nice if the content of that JSON body could somehow be bubbled up to the user in the Actions interface.

Allow option to keep only last X number of releases

Problem:
Creating snapshot releases and manually removing older releases to only keep the last X number of them is tedious.

Solution:
Allow an option with create-release that will allow passing an Integer such as 4 to keep only the last 3 releases including the 1 newly created release. Using this option would delete all older releases and keep only the last 4 published. This optional cleanup action would run after the release is created, not before.

Alternatives:
Manually keeping track and deleting via UI. Automating by custom scripting.

accidentally create a release for master branch make later push to master fail

Here's the workflows, which should run when tag event happen, but I accidentally comments out those filter, so it create a release tag with name (refs/heads/master) , which cause later push to remote master fail.

I don't found anyway to delete that tag on github, I fixed by delete repository first then recreate again ( which all activities and release are lost, so this sould not happen ).

[wen@234 k8snew actiontest]$ git push origin master
error: dst refspec refs/heads/master matches more than one.
error: failed to push some refs to 'https://github.com/chinglinwen/actiontest.git'
[wen@234 k8snew actiontest]$ git push origin --delete refs/heads/master
error: dst refspec refs/heads/master matches more than one.
error: failed to push some refs to 'https://github.com/chinglinwen/actiontest.git'
[wen@234 k8snew actiontest]$ git tag
2019-10-29
refs/heads/master
v0.0.1
[wen@234 k8snew actiontest]$
on:
  push:
    # Sequence of patterns matched against refs/tags
    # tags:
    #   - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10

name: Upload Release Asset

jobs:
  build:
    name: Upload Release Asset
    runs-on: ubuntu-latest
    steps:
      - name: Set up Go 1.13
        uses: actions/setup-go@v1
        with:
          go-version: 1.13
        id: go

      - name: Check out code into the Go module directory
        uses: actions/checkout@v1

      - name: Get dependencies
        run: |
          go get -v -t -d ./...
          if [ -f Gopkg.toml ]; then
              curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
              dep ensure
          fi

      - name: Build
        run: |
          go build -v .
          echo run actiontest

      - name: Build project # This would actually build your project, using zip for an example artifact
        run: |
          zip --junk-paths actiontest actiontest README.md
      - name: Create Release
        id: create_release
        uses: actions/[email protected]
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ github.ref }}
          release_name: Release ${{ github.ref }}
          draft: false
          prerelease: false
      - name: Upload Release Asset
        id: upload-release-asset
        uses: actions/[email protected]
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./actiontest.zip
          asset_name: actiontest.zip
          asset_content_type: application/zip

Clarification on triggering events after release

The readme has the following line:

This will create a Release, as well as a release event, which could be handled by a third party service, or by GitHub Actions for additional uses, for example the @actions/upload-release-asset GitHub Action.

I think there should be some clarification that a release event created with the default github.token (or secrets.GITHUB_TOKEN), will not trigger another workflow. The user will have to use a personal access token for this to work.

Rename default branch

👋 This issue is to track the move over to using main as the default branch for this repo. We’d love your team's help in completing this transition.

Do not remove your old default branch, customers are going to be using it. We will be sending messages out about these changes, but if you want to message in your repository, that's fine as well.

  • Create a main branch.
  • You might need to rebase any pull requests you want to merge before changing the default branch.
  • Change the default branch in settings to main.
  • Update any documentation in this repo to refer to the new branch name, although using the version tag is still preferred.
  • Check that this Action works correctly for users who have a repository with a custom default branch name.
  • Close this issue and celebrate 🎉

We are aiming to complete this work by July 17th July 24th.

Tags point at wrong commit

My use-case is that I need to create release assets for every commit, across all branches, so this action seems ideal. However, when using it on branches, I've noticed that every tag ends up pointing at master HEAD, even though I've verified in an earlier step that the commit checked out by actions/checkout@v1 is in fact pointing at a commit on my branch.

Additionally, I'm trying to set the body to github.event.commits[0].message, and according to the output from the job, it is set to the correct commit message, but when I look at the list of releases in my repo, it has somehow been set to the commit message of master HEAD instead.

My pipeline looks like this:

    steps:
      - uses: actions/checkout@v1
      - id: artifact-version
        uses: fleskesvor/actions-test/actions/create-artifact-version@master
      - name: Test artifact version
        run: |
          echo "VERSION: ${VERSION}"
          echo "COMMIT MESSAGE: ${MESSAGE}"
          git log -1
        env:
          VERSION: ${{ steps.artifact-version.outputs.version }}
          MESSAGE: ${{ github.event.commits[0].message }}
      - id: github-release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ steps.artifact-version.outputs.version }}
          release_name: ${{ steps.artifact-version.outputs.version }}
          body: ${{ github.event.commits[0].message }}

Where fleskesvor/actions-test/actions/create-artifact-version@master is just a crude, custom made action to set a version/tag on a specific format.

Release based on PR

Hello, is there any functionality based on, for example, PR label so I can release with major/minor/patch update to release's tag?

I need it to automate release deploying with version changes (tenhobi/bachelors-thesis#8)

e.g. :

  • release v0.1.1
    then PR w/ label "minor"
  • release v0.2.0
    then PR w/ label "major"
  • release v1.0.0

Is it possible to avoid duplicate tag?

First I just want to say thank you for this great github action plugin.
I am having this issue whenever I am creating a PR against release branch I use this action to create release draft and automatically create a tag based on the PR title. But whenever I pushed new changes to the same branch where I create PR from, it automatically create a new release draft with the same tag.

Is there a way to avoid duplicate release tag in this action? So if there is already a release with the same tag, it should just not create new release.
So maybe an option like:

avoid_duplicate_tag: true

Improve `body`/`body_path` documentation

README.md:

body: Text describing the contents of the release. Optional, and not needed if using body_path.
body_path: A file with contents describing the release. Optional, and not needed if using body.

Of course body is not needed if using body_path and body_path is not needed if using body, since they are optional according to the documentation. What would be useful, however, is to know what happens when both or neither of them is defined.

Process Escape Characters in Release `body`

My use case: I'm using an environment variable to pass a parsed sub-section of my changelog into the release body.

The environment variable is defined in a previous step using https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions#set-an-environment-variable-set-env. From what I can tell, this logging command does not work with multi-line environment variables unless the newlines are escaped, so I replaced the newline character with the ascii characters \n. This environment variable can be passed successfully to further steps, and echo -e $CHANGELOG processes the escaped characters and shows newlines as expected.

But when passing body: ${{ env.CHANGELOG }} to actions/create-release, the created release shows ascii \n characters instead of newlines. Would it be possible to process escape characters in the body the same way echo -e does? If this isn't desired as default behaviour, could an input be added to specify this?

Thanks :)

Releases created by this action ignores by other workflows

we have 2 workflows:

  • workflow to automate the release creation using this create-release action.
    the release indeed created using github-action bot.
  • workflow to automate the deployment while triggered for every new Release that being created. (on: release types: [ created])

the thing when releases created by users everything works as before and deployment triggered.
when the release created through this action, the deploy workflow does not runs , like the event o of release is not firing.
according to this thread https://github.community/t5/GitHub-Actions/Github-actions-workflow-not-triggering-with-tag-push/td-p/39685 its seems like a known issue, and using our own SECRET it works as before.

anything we can do?
it requires a personal user token or to get additional seat.

Make "release_name" optional

I would like to use this action to create a release based on a tag, using the tag text as the release name and body (e.g. the first line of the tag text is the release name, the rest is the body).

On the web ui I can just leave the release name empty, and it will use the first line as title, prefixed with the tag.

Is there any reason the release_name parameter is required?

Avoid creating tag

Looks like this action automatically creates a new tag if necessary, which is okay, but it also fails if the tag exists!
In our pipeline we create the tag first, and then create the release. Any possibility to support this?

##[error]Bad credentials Someone can help me ? Thanks.

This my workflow yaml. I think there is no error.
`

- name: Gzip
  run: |
    mkdir openwrt-img-${{ github.run_id }}
    cp -rf /home/runner/work/openwrt-cc/openwrt-cc/openwrt/bin/targets/x86/64/openwrt-x86-64-combined-squashfs.img.gz openwrt-img-${{ github.run_id }}
    tar -czvf openwrt-img-${{ github.run_id }}.tar.gz openwrt-img-${{ github.run_id }}

- name: Create Release
  id: create_release
  uses: actions/create-release@v1
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  with:
    tag_name: ${{ github.run_id }}
    release_name: Release ${{ github.ref }}
    draft: false
    prerelease: false
- name: Upload Release Asset
  id: upload-release-asset 
  uses: actions/upload-release-asset@v1
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  with:
    upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps 
    asset_path: /home/runner/work/openwrt-cc/openwrt-cc/openwrt-img-${{ github.run_id }}.tar.gz
    asset_name: openwrt-img-${{ github.run_id }}.tar.gz
    asset_content_type: application/zip

`
But it always fails. Someone can help me ? Thanks.
QQ图片20200303200508

Support for publishing latest draft release

Is it possible to publish the latest draft release with this action?
I use actions/release-drafter which automatically adds my latest changes to a draft. I want to use this action to publish that release draft automatically when the workflow is triggered.

"Body" of release not created correctly.

Testing, I copied and pasted the example on the README but did not get expected results. The release was created with the correct tags and commits but the body of the release was empty. When I changed to use master this worked.

actions/create-release@v1

Body of release was empty.

actions/create-release@master

Body of release correctly displayed.

I assume everyone else is using @v1 so what am I doing wrong? Or is there a bug fix in the master branch?

Thanks!!

Validation Failed. What is going wrong?

The task always ends in Validation Failed. I enabled the debugging output but this doesn't make any sense to me. I have pasted the debug output and job definition below.

Debug output:

1
##[debug]Evaluating: secrets.GITHUB_TOKEN
2
##[debug]Evaluating Index:
3
##[debug]..Evaluating secrets:
4
##[debug]..=> Object
5
##[debug]..Evaluating String:
6
##[debug]..=> 'GITHUB_TOKEN'
7
##[debug]=> '***'
8
##[debug]Result: '***'
9
##[debug]Evaluating condition for step: 'Create Release'
10
##[debug]Evaluating: success()
11
##[debug]Evaluating success:
12
##[debug]=> true
13
##[debug]Result: true
14
##[debug]Starting: Create Release
15
##[debug]Loading inputs
16
##[debug]Evaluating: format('Release {0}', github.ref)
17
##[debug]Evaluating format:
18
##[debug]..Evaluating String:
19
##[debug]..=> 'Release {0}'
20
##[debug]..Evaluating Index:
21
##[debug]....Evaluating github:
22
##[debug]....=> Object
23
##[debug]....Evaluating String:
24
##[debug]....=> 'ref'
25
##[debug]..=> 'refs/heads/master'
26
##[debug]=> 'Release refs/heads/master'
27
##[debug]Result: 'Release refs/heads/master'
28
##[debug]Evaluating: format('Release {0}', github.ref)
29
##[debug]Evaluating format:
30
##[debug]..Evaluating String:
31
##[debug]..=> 'Release {0}'
32
##[debug]..Evaluating Index:
33
##[debug]....Evaluating github:
34
##[debug]....=> Object
35
##[debug]....Evaluating String:
36
##[debug]....=> 'ref'
37
##[debug]..=> 'refs/heads/master'
38
##[debug]=> 'Release refs/heads/master'
39
##[debug]Result: 'Release refs/heads/master'
40
##[debug]Loading env
41
Run actions/create-release@latest
50
##[error]Validation Failed
51
##[debug]Node Action run completed with exit code 1
52
##[debug]Finishing: Create Release

Job yml:

  release:
    runs-on: ubuntu-latest
    steps:
     - name: Create Release
        id: create_release
        uses: actions/create-release@latest
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: Release ${{ github.ref }}
          release_name: Release ${{ github.ref }}
          body: This release was automatically prepared in GitHub Actions.
          draft: false
          prerelease: false

Unable to do scenario: draft release, upload asset, publish a release

I am not able to create this workflow:

  1. Draft a release
  2. Upload release assets
  3. Publish a release

The reason I want to do it this way, is to have the link to assets already included in the notification email about the new release.
Is there a way to do this without using the hub or GitHub API manually?

[Feature request] Allow attaching files

When one is creating a release manually via GitHub Web interface, it is possible to attach an arbitrary file to a release. I personally use it for attaching jar file to a release.

Is it possible to add this feature to this action? I think it would be very useful.

How to use set-env value in tag_name or release_name

How can I use env value in create-release?

name: CI

on: [push]

jobs:
  build:

    runs-on: macos

    steps:
      - name: Check out code
        uses: actions/checkout@v1
 
      - name: Set env
        run:  echo ::set-env name=MYTEST::$(date "+%Y.%m.%d")
      
      - name: Install deps
        run: |
          echo MYTEST=${MYTEST}
 
      - name: Create Release
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
        with:
          tag_name: ${{ github.sha }}.${MYTEST}
          release_name: Release ${{ github.sha }}.${MYTEST}
          draft: false
          prerelease: false  
          

output:

Run actions/checkout@v1

Run echo ::set-env name=MYTEST::$(date "+%Y.%m.%d")

Run echo MYTEST=${MYTEST}

MYTEST=2020.01.13

Run actions/create-release@v1
  with:
    tag_name: 2a746e6940875ac2a63a3747320cc41041fd3783.${MYTEST}
    release_name: Release 2a746e6940875ac2a63a3747320cc41041fd3783.${MYTEST}
    draft: false
    prerelease: false
  env:
    MYTEST: 2020.01.13
    GITHUB_TOKEN: ***

then it will create 2a746e6940875ac2a63a3747320cc41041fd3783.${MYTEST} not 2a746e6940875ac2a63a3747320cc41041fd3783.2020.01.13

Add a LICENSE.md

The contributing guidelines link to a non-existent license document.

It takes about 2 hours to compile the file, and the token is only valid for 1 hour

How can I solve this problem?
Is there any alternative to this token?

  release:
    name: Create Release
    needs: build
    runs-on: ubuntu-latest
    steps:
      - name: Download OpenWrt_firmware
        uses: actions/download-artifact@v1
        with:
          name: OpenWrt_firmware
      - name: Create Release
        id: create_release
        uses: actions/create-release@v1
        env:
          RELEASES_TOKEN: ${{ secrets.RELEASES_TOKEN }}
        with:
          tag_name: ${{ github.ref }} 
          release_name: Release ${{ github.ref }}
          body: ${{ github.ref }}
          draft: false
          prerelease: false
      - name: Upload Release Asset
        id: upload-release-asset
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} 
          asset_path: ./OpenWrt_firmware
          asset_name: ${{ env.FILE_NAME }}-${{ steps.create_release.outputs.tag }}.zip
          asset_content_type: application/zip

image

Explicit support for semantic versioning pre-releases.

Hi all,

I am wondering if explicit support for semantic versioning would be a desirable and reasonable addition to this action?

What I am proposing is allowing semver as valid value for the prerelease field in the action configuration. Use of this value would mark a release as a "full-release" (i.e., non-pre-release) only if:

If such a feature is welcome I'll attempt to submit a PR :)

/cc @ezzatron

Question: Is this supposed to work for creating releases of GitHub Actions found in Marketplace?

I have successfully used actions/create-release to create releases for libraries here on GitHub.

Today I have built a GitHub Action that I have - so far manually - released to GitHub Marketplace.

It appears that creating a release for GitHub Actions published to the GitHub Marketplace is currently not supported, is that right?

Here's the corresponding workflow:

# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

name: "Continuous Deployment"

on:
  push:
    branches:
      - "master"
    tags:
      - "**"

jobs:
  continuous-deployment:
    name: "Continuous Deployment"

    runs-on: "ubuntu-latest"

    env:
      DOCKER_IMAGE: "ergebnis/composer-root-version-action"
      DOCKER_USERNAME: "ergebnis"

    steps:
      - name: "Checkout"
        uses: "actions/[email protected]"

      - name: "Build Docker image"
        run: "docker build --tag ${{ env.DOCKER_IMAGE }}:latest ."

      - name: "Docker Login"
        if: "'refs/heads/master' == github.ref || startsWith(github.ref, 'refs/tags/')"
        run: "echo ${{ secrets.DOCKER_PASSWORD }} | $(which docker) login --password-stdin --username ${{ env.DOCKER_USERNAME }}"

      - name: "Push Docker image (latest)"
        if: "'refs/heads/master' == github.ref || startsWith(github.ref, 'refs/tags/')"
        run: "docker push ${{ env.DOCKER_IMAGE }}:latest"

      - name: "Determine tag"
        if: "startsWith(github.ref, 'refs/tags/')"
        id: "determine-tag"
        run: "echo \"::set-output name=tag::${GITHUB_REF#refs/tags/}\""

      - name: "Tag Docker image (versioned)"
        if: "startsWith(github.ref, 'refs/tags/')"
        run: "docker tag ${{ env.DOCKER_IMAGE }} ${{ env.DOCKER_IMAGE }}:${{ steps.determine-tag.outputs.tag }}"

      - name: "Push Docker image (versioned)"
        if: "startsWith(github.ref, 'refs/tags/')"
        run: "docker push ${{ env.DOCKER_IMAGE }}:${{ steps.determine-tag.outputs.tag }}"

      - name: "Docker Logout"
        if: "'refs/heads/master' == github.ref || startsWith(github.ref, 'refs/tags/')"
        run: "docker logout"

      - name: "Create release"
        if: "startsWith(github.ref, 'refs/tags/')"
        uses: "actions/[email protected]"
        env:
          GITHUB_TOKEN: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"
        with:
          draft: false
          prerelease: false
          release_name: "${{ steps.determine-tag.outputs.tag }}"
          tag_name: "${{ steps.determine-tag.outputs.tag }}"

which currently fails with

Screen Shot 2020-02-06 at 20 09 35

💁‍♂ For an example, see https://github.com/ergebnis/composer-root-version-action/runs/430394008?check_suite_focus=true.

actions/create-release@v1 is not found

When trying to use actions/create-release@v1 not actions/create-release@master, it seems to be not found as follows.

workflow:

      - uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ github.ref }}
          release_name: Release ${{ github.ref }}

build logs:

2019-11-05T12:38:27.1324943Z ##[section]Starting: Request a runner to run this job
2019-11-05T12:38:27.7073875Z Requesting a hosted runner in current repository's account/organization with labels: 'ubuntu-latest', require runner match: True
2019-11-05T12:38:27.9223384Z Labels matched hosted runners has been found, waiting for one of them get assigned for this job.
2019-11-05T12:38:27.9480373Z ##[section]Finishing: Request a runner to run this job
2019-11-05T12:38:33.7981673Z Current runner version: '2.160.0'
2019-11-05T12:38:33.7982698Z Prepare workflow directory
2019-11-05T12:38:33.8214357Z Prepare all required actions
2019-11-05T12:38:33.8246552Z Download action repository 'actions/checkout@v1'
2019-11-05T12:38:35.1115788Z Download action repository 'actions/setup-node@v1'
2019-11-05T12:38:36.1045139Z Download action repository 'actions/create-release@v1'
2019-11-05T12:38:36.2948582Z ##[warning]Failed to download action 'https://api.github.com/repos/actions/create-release/tarball/v1'. Error Response status code does not indicate success: 404 (Not Found).
2019-11-05T12:38:36.2954290Z ##[warning]Back off 16.36 seconds before retry.
2019-11-05T12:38:52.7780070Z ##[warning]Failed to download action 'https://api.github.com/repos/actions/create-release/tarball/v1'. Error Response status code does not indicate success: 404 (Not Found).
2019-11-05T12:38:52.7782936Z ##[warning]Back off 21.903 seconds before retry.
2019-11-05T12:39:14.8511327Z ##[error]Response status code does not indicate success: 404 (Not Found).

Sharing a variable between jobs

  • Currently, the only way to interact between jobs is by creating a file (preferable .txt file).
  • That is like an overkill when it comes to sharing a single variable.
  • Would be very good if there's a method way more simpler.

Document `commitish` option

I was looking for another action since it seemed this one didn't support it but it does. Please add it to the README.

Cannot trim undefined

Found 1 pull request(s) associated with commit 9755ecee1098eb5142a0bea53814e2413f50288d
  ##[error]Cannot read property 'trim' of undefined
  (node:18245) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'trim' of undefined
      at e.exports (/actions-runner/_work/_actions/marvinpinto/action-automatic-releases/latest/dist/index.js:1:572296)
      at Function.e.exports.sync (/actions-runner/_work/_actions/marvinpinto/action-automatic-releases/latest/dist/index.js:1:570888)
      at /actions-runner/_work/_actions/marvinpinto/action-automatic-releases/latest/dist/index.js:1:222656
      at Generator.next (<anonymous>)
      at s (/actions-runner/_work/_actions/marvinpinto/action-automatic-releases/latest/dist/index.js:1:221551)
      at processTicksAndRejections (internal/process/task_queues.js:93:5)
  (node:18245) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
  (node:18245) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Add support .md file in body

Hi,
I'm wondering if there is any chance to add support to include .md file in body section. Right now, to show all issues from project, you have to add them manually to body.

How it works now

with:
          tag_name: ${{ github.ref }}
          release_name: Release ${{ github.ref }}
          body: |
            Some text
            [issueNumber](issueLink)
          draft: false
          prerelease: false

Additional option

with:
          tag_name: ${{ github.ref }}
          release_name: Release ${{ github.ref }}
          body.file: |
            body.md
          draft: false
          prerelease: false

The result of additional option will be shown in Release section, all issues created in project from body.md file

image

Document an example of tagging with a version

It took a few attempts to find a solution to get a version # to tag the releases with. In my case I have a VERSION file containing the version number, such as 0.1.0. This solution should be applicable even if the desired version is stored elsewhere so long as it can be accessed from a bash shell.

The first step gets the version via a run command and sets the output. See the documentation for set-output.

- name: Get version
   id: get_version
   run: echo "::set-output name=version::$(cat VERSION)"

Then the id can be used to access the output for the tag and release name:

- name: Create release
  id: create_release
  uses: actions/create-release@v1
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  with:
    tag_name: v${{ steps.get_version.outputs.version }}
    release_name: v${{ steps.get_version.outputs.version }}
    draft: false
    prerelease: false

Is there a better way? I had no success using cat outside of a run step, but I didn't try every possibility.

In #31 I noticed that @fleskesvor wrote a more elaborate solution, which is another reason to document what GitHub Actions provides out-of-the-box.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.