From 0d3854d5a38cf679e2302d1b0a602f3decaed1da Mon Sep 17 00:00:00 2001 From: Jochen Schalanda Date: Wed, 28 Aug 2024 22:31:03 +0200 Subject: [PATCH] Fix release process --- .github/workflows/build.yml | 20 +++++++++ .github/workflows/maven.yml | 29 ------------ .github/workflows/release.yml | 28 +++--------- .github/workflows/trigger-release.yml | 65 ++++++++++++--------------- pom.xml | 22 +++++++++ 5 files changed, 75 insertions(+), 89 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/maven.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..1fc04e8 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,20 @@ +--- +name: Build +# yamllint disable-line rule:truthy +on: + push: + branches: + - release/* + pull_request: +jobs: + yamllint: + uses: dropwizard/workflows/.github/workflows/yamllint.yml@main + build: + strategy: + fail-fast: false + matrix: + java-version: ['11', '17', '21'] + uses: dropwizard/workflows/.github/workflows/maven.yml@main + secrets: inherit + with: + java-version: ${{ matrix.java-version }} diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml deleted file mode 100644 index 1ae43c3..0000000 --- a/.github/workflows/maven.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Java CI -on: - push: - branches: - - release/* - pull_request: - branches: - - release/* -jobs: - build: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - java_version: ['11', '17', '21'] - os: ['ubuntu-latest', 'windows-latest'] - env: - JAVA_OPTS: "-XX:+TieredCompilation -XX:TieredStopAtLevel=1" - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - name: Set up JDK - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4 - with: - distribution: 'zulu' - java-version: ${{ matrix.java_version }} - - name: Build - run: ./mvnw --no-transfer-progress -V -B -fae -s .github/settings.xml -e install diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c543fa8..a8848f1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,29 +1,11 @@ +--- name: Release +# yamllint disable-line rule:truthy on: push: tags: - - 'v*' + - 'v*' jobs: release: - runs-on: 'ubuntu-latest' - env: - JAVA_OPTS: "-XX:+TieredCompilation -XX:TieredStopAtLevel=1" - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - name: Set up JDK - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4 - with: - distribution: 'zulu' - java-version: '11' - cache: 'maven' - server-id: ossrh - server-username: CI_DEPLOY_USERNAME - server-password: CI_DEPLOY_PASSWORD - gpg-passphrase: GPG_PASSPHRASE - gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} - - name: Build and Deploy - run: ./mvnw -B -V -ntp -DperformRelease=true deploy - env: - CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }} - CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }} - GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + uses: dropwizard/workflows/.github/workflows/release.yml@main + secrets: inherit diff --git a/.github/workflows/trigger-release.yml b/.github/workflows/trigger-release.yml index 0ed4b29..a172da1 100644 --- a/.github/workflows/trigger-release.yml +++ b/.github/workflows/trigger-release.yml @@ -1,13 +1,9 @@ +--- +# yamllint disable rule:line-length name: Trigger Release +# yamllint disable-line rule:truthy on: workflow_dispatch: - inputs: - releaseVersion: - description: 'Version of the next release' - required: true - developmentVersion: - description: 'Version of the next development cycle (must end in "-SNAPSHOT")' - required: true jobs: trigger-release: runs-on: 'ubuntu-latest' @@ -16,33 +12,28 @@ jobs: env: JAVA_OPTS: "-XX:+TieredCompilation -XX:TieredStopAtLevel=1" steps: - - uses: webfactory/ssh-agent@dc588b651fe13675774614f8e6a936a468676387 # v0.9.0 - with: - ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - with: - ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} - - name: Set up JDK - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4 - with: - distribution: 'zulu' - java-version: '17' - cache: 'maven' - server-id: ossrh - server-username: ${{ secrets.CI_DEPLOY_USERNAME }} - server-password: ${{ secrets.CI_DEPLOY_PASSWORD }} - gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }} - gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} - - name: Set up Git - run: | - git config --global committer.email "48418865+dropwizard-committers@users.noreply.github.com" - git config --global committer.name "Dropwizard Release Action" - git config --global author.email "${GITHUB_ACTOR}@users.noreply.github.com" - git config --global author.name "${GITHUB_ACTOR}" - - name: Prepare release - run: ./mvnw -V -B -ntp -Prelease -DreleaseVersion=${{ inputs.releaseVersion }} -DdevelopmentVersion=${{ inputs.developmentVersion }} release:prepare - - name: Rollback on failure - if: failure() - run: | - ./mvnw -B release:rollback -Prelease - echo "You may need to manually delete the GitHub tag, if it was created." + - uses: webfactory/ssh-agent@dc588b651fe13675774614f8e6a936a468676387 # v0.9.0 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} + - name: Set up JDK + uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4 + with: + distribution: 'zulu' + java-version: '17' + cache: 'maven' + server-id: ossrh + server-username: ${{ secrets.CI_DEPLOY_USERNAME }} + server-password: ${{ secrets.CI_DEPLOY_PASSWORD }} + gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }} + gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} + - name: Set up Git + run: | + git config --global committer.email "48418865+dropwizard-committers@users.noreply.github.com" + git config --global committer.name "Dropwizard Release Action" + git config --global author.email "${GITHUB_ACTOR}@users.noreply.github.com" + git config --global author.name "${GITHUB_ACTOR}" + - name: Tag release + run: ./mvnw -V -B -ntp -Prelease scm:tag diff --git a/pom.xml b/pom.xml index 5c879ae..4124427 100644 --- a/pom.xml +++ b/pom.xml @@ -23,6 +23,12 @@ A collection of Maven Archetypes for bootstrapping development of a new Dropwizard Service. + + scm:git:https://github.com/dropwizard/dropwizard-archetypes + scm:git:ssh://git@github.com/dropwizard/dropwizard-archetypes.git + https://github.com/dropwizard/dropwizard-archetypes + + java-simple @@ -172,5 +178,21 @@ true + + release + + + + org.apache.maven.plugins + maven-scm-plugin + 2.1.0 + + developerConnection + v${project.version} + + + + +