From a0b6e25c31eb0cccd29e6d719663bd7623f17c01 Mon Sep 17 00:00:00 2001 From: Jan-Olav Eide Date: Fri, 4 Dec 2020 13:33:47 +0100 Subject: [PATCH] semver (#52) --- .github/release-drafter.yml | 28 +++++++++++++++++++++++++ .github/workflows/build.yml | 18 +++++++--------- .github/workflows/release.yml | 39 +++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 11 deletions(-) create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..8a2a85c --- /dev/null +++ b/.github/release-drafter.yml @@ -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 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1354875..e136db4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 @@ -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 - diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..5f050b2 --- /dev/null +++ b/.github/workflows/release.yml @@ -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