Skip to content

Commit

Permalink
Automate creation of releases
Browse files Browse the repository at this point in the history
Publishing to marketplace requires manual editing of release. See actions/create-release#99
  • Loading branch information
JosephDuffy committed Jan 28, 2021
1 parent 41a2178 commit 05338e3
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release

on:
push:
tags:
- "v*"

jobs:
create_release:
name: Create Release
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Fetch tag
run: git fetch --depth=1 origin +${{ github.ref }}:${{ github.ref }}

- name: Get the release version
id: release_version
run: echo "::set-output name=version::${GITHUB_REF/refs\/tags\//}"

- name: Get release description
run: |
description="$(git tag -ln --format=$'%(contents:subject)\n\n%(contents:body)' ${{ steps.release_version.outputs.version }})"
# Fix set-output for multiline strings: https://github.community/t/set-output-truncates-multiline-strings/16852
description="${description//'%'/'%25'}"
description="${description//$'\n'/'%0A'}"
description="${description//$'\r'/'%0D'}"
echo "$description"
echo "::set-output name=description::$description"
id: release_description

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.release_version.outputs.version }}
release_name: ${{ steps.release_version.outputs.version }}
body: ${{ steps.release_description.outputs.description }}
prerelease: ${{ contains(steps.release_version.outputs.version, '-') }}

0 comments on commit 05338e3

Please sign in to comment.