Skip to content

Commit

Permalink
Add automatic creation of GH release to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
RohanNagar committed May 24, 2024
1 parent de8fc4a commit ea4704c
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,49 @@ jobs:
uses: codecov/codecov-action@v4
with:
directory: .

- name: Upload built JAR
uses: actions/upload-artifact@v4
with:
name: jmail-jar
path: target/jmail-*.jar

create-release:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
needs: [ build ]

steps:
- uses: actions/checkout@v4
- name: Download JAR
uses: actions/download-artifact@v4
with:
name: jmail-jar
path: target

- name: Set tag number
id: tag
run: echo "tag_name=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT

- name: Create release notes file
run: sed '/^## ${{ steps.tag.outputs.tag_name }}/,/^---/!d;//d' CHANGELOG.md > release_body.md

- name: Create GitHub Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body_path: release_body.md

- name: Upload JAR to Release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: target/jmail-${{ steps.tag.outputs.tag_name }}.jar
asset_name: jmail-${{ steps.tag.outputs.tag_name }}.jar
asset_content_type: application/java-archive

0 comments on commit ea4704c

Please sign in to comment.