Last active
September 5, 2020 23:58
-
-
Save zkingboos/b40eb29b657a6da04f17f8bce286ffa7 to your computer and use it in GitHub Desktop.
[Continous Delivery] Creates releases after each push! (Credits to @zkingboos and @HenryFabio)
This file contains hidden or 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
# This is a basic workflow to help you get started with Actions | |
name: 'maven-workflow' | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 1.8 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 1.8 | |
- name: Build with Maven | |
run: | | |
mvn -B package --file pom.xml | |
- name: Setup project version | |
run: | | |
MAVEN_PROJECT_VERSION=$(mvn -Dexec.executable='echo' -Dexec.args='${project.version}' --non-recursive exec:exec -q) | |
echo "Debug maven project version $MAVEN_PROJECT_VERSION" | |
echo "::set-env name=PROJECT_VERSION::$MAVEN_PROJECT_VERSION" | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.PROJECT_VERSION }} | |
release_name: "${{ format('{0} [Release #{1}]', github.event.head_commit.message, github.run_id) }}" | |
body: | | |
## Github Actions - Continous Delivery | |
- ### Build id: | |
${{ | |
format( | |
' > **{0}** - [#{1}][id-ref-link]', | |
github.event.head_commit.message, | |
github.sha | |
) | |
}} | |
${{ | |
format( | |
' from [{0}][from-repository]', | |
github.repository | |
) | |
}} | |
${{ | |
format( | |
' open in [jitpack.io][jitpack-url]' | |
) | |
}} | |
<br/> | |
--<!>-- | |
Build by @${{ github.event.head_commit.committer.name }} | |
[id-ref-link]: ${{ github.event.head_commit.url }} | |
[from-repository]: ${{ github.event.repository.url }} | |
[jitpack-url]: https://jitpack.io/#${{ github.repository }}/${{ env.PROJECT_VERSION }} | |
draft: false | |
prerelease: false | |
- name: Uploud release assets | |
uses: AButler/[email protected] | |
with: | |
files: 'target/*.jar' | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
release-tag: ${{ env.PROJECT_VERSION }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment