From 1c967c19f24ad8dc623c89dc0306a4179eaa8e16 Mon Sep 17 00:00:00 2001 From: Julien Ponge Date: Wed, 20 Sep 2023 21:32:45 +0200 Subject: [PATCH 1/2] ci: perform Git commits as smallrye-ci --- .build/justfile-for-release | 2 +- pom.xml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.build/justfile-for-release b/.build/justfile-for-release index e88e10544..1977c156f 100644 --- a/.build/justfile-for-release +++ b/.build/justfile-for-release @@ -29,7 +29,7 @@ init-gpg: # Initialize Git init-git: @echo "Git setup" - git config --global user.name "${GITHUB_ACTOR}" + git config --global user.name "smallrye-ci" git config --global user.email "smallrye@googlegroups.com" # Steps before releasing diff --git a/pom.xml b/pom.xml index 58d232168..eab5da38c 100644 --- a/pom.xml +++ b/pom.xml @@ -547,6 +547,7 @@ dependabot[bot] bot jreleaserbot + smallrye-ci From c43fc92769473ef1909c7e32dea928f16135bacf Mon Sep 17 00:00:00 2001 From: Julien Ponge Date: Wed, 20 Sep 2023 21:56:52 +0200 Subject: [PATCH 2/2] ci: extract the Maven Central deployment as a workflow Given how unreliable pushing to Maven Central is, we are better off with a release workflow that makes a source release, while another (repeatable) workflow can do the deployment steps. In fact a deployment can fail due to a gateway error while the artifacts actually end up on Maven Central. --- .build/justfile-for-release | 7 ++++-- .github/workflows/build-main.yml | 6 ++--- .../push-release-to-maven-central.yml | 25 +++++++++++++++++++ 3 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/push-release-to-maven-central.yml diff --git a/.build/justfile-for-release b/.build/justfile-for-release index 1977c156f..0e0ede66f 100644 --- a/.build/justfile-for-release +++ b/.build/justfile-for-release @@ -56,14 +56,17 @@ release: pre-release git push @echo "Call JReleaser" ./mvnw -settings .build/maven-ci-settings.xml --batch-mode --no-transfer-progress -Pjreleaser jreleaser:full-release -pl :mutiny-project - @echo "Deploy to Maven Central" - -./mvnw --settings maven-settings.xml --batch-mode --no-transfer-progress deploy -Prelease -DskipTests @echo "Bump to 999-SNAPSHOT and push upstream" ./mvnw --settings .build/maven-ci-settings.xml --batch-mode --no-transfer-progress versions:set -DnewVersion=999-SNAPSHOT -DgenerateBackupPoms=false ./mvnw --settings .build/maven-ci-settings.xml --batch-mode --no-transfer-progress versions:set -DnewVersion=999-SNAPSHOT -DgenerateBackupPoms=false -pl bom git commit -am "chore(release): set development version to 999-SNAPSHOT" git push +# Deploy to Maven Central +deploy-to-maven-central: decrypt-secrets init-gpg + @echo "Deploy to Maven Central" + ./mvnw --settings maven-settings.xml --batch-mode --no-transfer-progress deploy -Prelease -DskipTests + # Steps post-release post-release: @echo "🚀 Post-release steps..." diff --git a/.github/workflows/build-main.yml b/.github/workflows/build-main.yml index e8396bd83..e7090ac15 100644 --- a/.github/workflows/build-main.yml +++ b/.github/workflows/build-main.yml @@ -20,12 +20,12 @@ jobs: java-version: 11 distribution: temurin cache: maven + - name: Install just + uses: taiki-e/install-action@just - name: Build with Maven run: ./mvnw --no-transfer-progress -s .build/maven-ci-settings.xml -B clean verify - name: Deploy snapshots env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SECRET_FILES_PASSPHRASE: ${{ secrets.SECRET_FILES_PASSPHRASE }} - run: | - .build/decrypt-secrets.sh - .build/deploy-snapshot.sh + run: just -f .build/justfile-for-release -d . deploy-to-maven-central diff --git a/.github/workflows/push-release-to-maven-central.yml b/.github/workflows/push-release-to-maven-central.yml new file mode 100644 index 000000000..911704269 --- /dev/null +++ b/.github/workflows/push-release-to-maven-central.yml @@ -0,0 +1,25 @@ +name: Push a release to Maven Central + +on: + push: + tags: + - '2.*' + +jobs: + release: + runs-on: ubuntu-latest + env: + SECRET_FILES_PASSPHRASE: ${{ secrets.SECRET_FILES_PASSPHRASE }} + steps: + - name: Git checkout + uses: actions/checkout@v3 + - name: Java setup + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'temurin' + cache: maven + - name: Install just + uses: taiki-e/install-action@just + - name: Deploy tp Maven Central + run: just -f .build/justfile-for-release -d . deploy-to-maven-central