diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 00000000000..6629c04a17d --- /dev/null +++ b/.github/release-drafter.yml @@ -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' diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index 9463d591a03..b27edd4bc8a 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -7,6 +7,9 @@ on: branches: - main jobs: + #-------------------------------------------------- + # Build and Tests the project + #-------------------------------------------------- tests: name: tests runs-on: ubuntu-latest @@ -44,6 +47,9 @@ jobs: name: jar path: '${{ github.workspace }}/target/*.jar' retention-days: 1 + #-------------------------------------------------- + # Tests generated projects + #-------------------------------------------------- generation: needs: tests runs-on: ubuntu-latest @@ -77,6 +83,9 @@ jobs: cd /tmp/beer/ chmod +x mvnw ./mvnw clean verify + #-------------------------------------------------- + # Send analysis to Codecov + #-------------------------------------------------- codecov: needs: generation name: codecov @@ -88,7 +97,7 @@ jobs: uses: actions/download-artifact@v2 with: name: jacoco - - name: 'Codecov: sending analyzis...' + - name: 'Codecov: sending analysis...' uses: codecov/codecov-action@v2 with: files: jacoco.xml diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 00000000000..5e82ac7e83f --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -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 }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000000..aef2c45fc96 --- /dev/null +++ b/.github/workflows/release.yml @@ -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 diff --git a/release.sh b/release.sh new file mode 100755 index 00000000000..50b5fc13cca --- /dev/null +++ b/release.sh @@ -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 " >&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