-
-
Notifications
You must be signed in to change notification settings - Fork 216
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 #331 from pascalgrimaud/release-drafter-and-automa…
…ted-release Add Release Drafter and Automated Release
- Loading branch information
Showing
5 changed files
with
224 additions
and
1 deletion.
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,46 @@ | ||
template: | | ||
## Release Notes | ||
$CHANGES | ||
exclude-contributors: | ||
- 'dependabot' | ||
- 'dependabot[bot]' | ||
- 'github-actions[bot]' | ||
change-template: '- $TITLE - [#$NUMBER]($URL) by @$AUTHOR' | ||
categories: | ||
- title: ⭐ Important fixes and improvements | ||
labels: | ||
- 'theme: important' | ||
- title: 💎 Features & Enhancements | ||
labels: | ||
- 'area: enhancement :wrench:' | ||
- 'area: feature request :bulb:' | ||
- title: 🐞 Bug Fixes | ||
labels: | ||
- 'area: bug :bug:' | ||
- title: 🖥️ Frontend | ||
labels: | ||
- 'client: angular' | ||
- 'client: react' | ||
- 'client: vue' | ||
- title: 🍃 Spring Boot | ||
labels: | ||
- 'server: spring boot' | ||
- title: 🔒 Authentication/Security | ||
labels: | ||
- 'theme: security' | ||
- title: 🪶 Maven | ||
labels: | ||
- 'theme: maven' | ||
- title: 🐘 Gradle | ||
labels: | ||
- 'theme: gradle' | ||
- title: 📝 Documentation | ||
label: 'area: documentation:books:' | ||
- title: 📦 Dependency updates | ||
label: 'theme: dependencies' | ||
- title: 💩 Spam/Invalid | ||
labels: | ||
- 'area: spam' | ||
- 'area: invalid' |
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
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,14 @@ | ||
name: Release Drafter | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
update_release_draft: | ||
if: github.repository == 'jhipster/jhipster-lite' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: release-drafter/release-drafter@v5 | ||
id: release-drafter | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,84 @@ | ||
name: Release | ||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
jobs: | ||
#-------------------------------------------------- | ||
# Build and Tests the project | ||
#-------------------------------------------------- | ||
tests: | ||
name: tests | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
steps: | ||
- name: 'Setup: checkout project' | ||
uses: actions/checkout@v2 | ||
- name: 'Setup: environment' | ||
id: setup | ||
uses: ./.github/actions/setup | ||
- name: 'Init: cache local Maven repository' | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven- | ||
- name: 'Init: install Node.js packages' | ||
run: npm ci | ||
- name: 'Check: prettier' | ||
run: npm run prettier:check | ||
- name: 'Test: run backend tests' | ||
run: | | ||
chmod +x mvnw | ||
./mvnw clean verify | ||
- name: 'Artifact: upload JAR' | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: jar | ||
path: '${{ github.workspace }}/target/*.jar' | ||
retention-days: 1 | ||
#-------------------------------------------------- | ||
# Release | ||
#-------------------------------------------------- | ||
release: | ||
if: startsWith(github.event.ref, 'refs/tags/v') | ||
name: release | ||
needs: tests | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
steps: | ||
- name: 'Setup: checkout project' | ||
uses: actions/checkout@v2 | ||
- name: 'Artifact: download JAR' | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: jar | ||
path: ./target/ | ||
- name: 'Release: get variables from artifact' | ||
id: artifact_variables | ||
run: | | ||
ARTIFACT_PATHNAME=$(ls target/*.jar | head -n 1) | ||
ARTIFACT_NAME=$(basename $ARTIFACT_PATHNAME) | ||
ARTIFACT_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout) | ||
echo ::set-output name=artifact_asset_name::${ARTIFACT_NAME} | ||
echo ::set-output name=artifact_asset_path::${ARTIFACT_PATHNAME} | ||
echo ::set-output name=artifact_version::${ARTIFACT_VERSION} | ||
- name: 'Release: publish release drafter' | ||
uses: release-drafter/release-drafter@v5 | ||
id: release-drafter-final | ||
with: | ||
publish: true | ||
tag: v${{ steps.artifact_variables.outputs.artifact_version }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: 'Release: upload artifact' | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.release-drafter-final.outputs.upload_url }} | ||
asset_name: ${{ steps.artifact_variables.outputs.artifact_asset_name }} | ||
asset_path: ${{ steps.artifact_variables.outputs.artifact_asset_path }} | ||
asset_content_type: application/java-archive |
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,70 @@ | ||
#!/bin/bash | ||
|
||
GIT_MAIN_BRANCH='main' | ||
GIT_REMOTE='upstream' | ||
|
||
show_syntax() { | ||
echo "You want to release a new version" | ||
echo " - current version: ${currentVersion}" | ||
echo " - release version: ${releaseVersion} (which is a patch)" | ||
echo " " | ||
echo "Usage: $0 <patch|minor|major>" >&2 | ||
exit 1 | ||
} | ||
|
||
currentVersion=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout) | ||
releaseVersion=${currentVersion//-SNAPSHOT/} | ||
|
||
checkGit=$(git status --porcelain|wc -l) | ||
if [[ $checkGit != 0 ]]; then | ||
echo "*** Check: there are uncommitted changes..." | ||
show_syntax | ||
fi | ||
|
||
if [ "$#" -ne 1 ]; then | ||
show_syntax | ||
fi | ||
|
||
echo "*** Git: update project..." | ||
git switch $GIT_MAIN_BRANCH | ||
git fetch $GIT_REMOTE | ||
git rebase $GIT_REMOTE/$GIT_MAIN_BRANCH | ||
|
||
if [[ "$1" == "patch" ]]; then | ||
echo "*** Version: remove SNAPSHOT and keep the version" | ||
./mvnw versions:set -DremoveSnapshot versions:commit -q | ||
|
||
elif [[ "$1" == "minor" ]]; then | ||
echo "*** Version: remove SNAPSHOT and change to minor version" | ||
./mvnw versions:set -DremoveSnapshot versions:commit -q | ||
./mvnw build-helper:parse-version versions:set \ | ||
-DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion}.0 \ | ||
versions:commit -q | ||
elif [[ "$1" == "major" ]]; then | ||
echo "*** Version: remove SNAPSHOT and change to major version" | ||
./mvnw versions:set -DremoveSnapshot versions:commit -q | ||
./mvnw build-helper:parse-version versions:set \ | ||
-DnewVersion=\${parsedVersion.nextMajorVersion}.0.0 \ | ||
versions:commit -q | ||
else | ||
show_syntax | ||
fi | ||
|
||
echo "*** Git: commit, tag and push tag..." | ||
releaseVersion=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout) | ||
npm version "${releaseVersion}" --no-git-tag-version | ||
|
||
git add . && git commit -m "Release v${releaseVersion}" | ||
git tag -a v"${releaseVersion}" -m "Release v${releaseVersion}" | ||
git push $GIT_REMOTE v"${releaseVersion}" | ||
|
||
echo "*** Version: add SNAPSHOT" | ||
./mvnw build-helper:parse-version versions:set \ | ||
-DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion}-SNAPSHOT \ | ||
versions:commit -q | ||
|
||
echo "*** Git: commit, push to $GIT_MAIN_BRANCH..." | ||
nextVersion=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout) | ||
npm version "${nextVersion}" --no-git-tag-version | ||
git add . && git commit -m "Update to next version v${nextVersion}" | ||
git push $GIT_REMOTE $GIT_MAIN_BRANCH |