Skip to content

Commit

Permalink
semver (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
janolaveide authored Dec 4, 2020
1 parent ef0da79 commit a0b6e25
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 11 deletions.
28 changes: 28 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name-template: $NEXT_PATCH_VERSION
tag-template: $NEXT_PATCH_VERSION
change-template: '- $TITLE (#$NUMBER) @$AUTHOR'
categories:
- title: '🚀 Features'
labels:
- 'feature'
- 'enhancement'
- title: '⚠️ Breaking Changes'
labels:
- 'breaking'
- title: '🐛 Bug Fixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: '🧰 Maintenance'
labels:
- 'chore'
- title: '⬆️ Dependency upgrades'
labels:
- 'bump'
- 'dependencies'
exclude-labels:
- 'skip-changelog'
template: |
## What's Changed
$CHANGES
18 changes: 7 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ on:
- 'CODEOWNERS'

jobs:
release-notes:
runs-on: ubuntu-latest
steps:
- name: Release Drafter
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
env:
VERSION: 2.1
Expand Down Expand Up @@ -44,14 +51,3 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.MVN_VERSION }}
release_name: Release ${{ env.MVN_VERSION }}
draft: false
prerelease: false

39 changes: 39 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Publish release

on:
release:
types: [published]

jobs:
publish-release:
runs-on: ubuntu-latest

steps:
- name: Checkout latest code
uses: actions/checkout@v2

- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11

- name: Setup build cache
uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Publish artifact
env:
GITHUB_USERNAME: x-access-token
GITHUB_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
# The GITHUB_REF tag comes in the format 'refs/tags/xxx'.
# So if we split on '/' and take the 3rd value, we can get the release name.
run: |
REPO_NAME=$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}')
NEW_VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3)
echo "-- Setting new release version ${NEW_VERSION} for ${REPO_NAME} --"
mvn -B versions:set -DnewVersion="${NEW_VERSION}" -DgenerateBackupPoms=false
echo "-- Build, test and deploy release to GPR --"
mvn -B --settings .github/.m2/settings.xml clean deploy -Dmaven.wagon.http.pool=false

0 comments on commit a0b6e25

Please sign in to comment.