-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #115 from cubing/lgarron/github-release
Add an action to release pushed tags as GitHub releases.
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: GitHub Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
Publish: | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
steps: | ||
- name: Calculate release name | ||
run: | | ||
GITHUB_REF=${{ github.ref }} | ||
RELEASE_NAME=${GITHUB_REF#"refs/tags/"} | ||
echo "RELEASE_NAME=${RELEASE_NAME}" >> $GITHUB_ENV | ||
# We'd use `github.event.head_commit.message`, but that includes the first line of the message. So we check out the code. | ||
- name: Check out code for release body calculation using `git` itself | ||
uses: actions/checkout@v3 | ||
- name: Calculate release body | ||
run: git log --format=%b -n 1 HEAD >> /tmp/body-path.txt | ||
- name: Publish release | ||
uses: softprops/action-gh-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ env.RELEASE_NAME }} | ||
body_path: /tmp/body-path.txt | ||
draft: false | ||
prerelease: false |