Micronaut Maven Plugin 4.7.1 #143
Workflow file for this run
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
name: Release | |
on: | |
release: | |
types: [published] | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
env: | |
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} | |
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USERNAME }} | |
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }} | |
MICRONAUT_CORE_BRANCH: "4.0.x" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.GH_TOKEN }} | |
- name: Cache Maven packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
settings-path: /tmp | |
- name: Setup Maven settings.xml | |
uses: s4u/maven-settings-action@v3.1.0 | |
with: | |
override: true | |
servers: '[{"id": "ossrh", "username": "${{ secrets.SONATYPE_USERNAME }}", "password": "${{ secrets.SONATYPE_PASSWORD }}"}]' | |
properties: '[{"gpg.executable": "gpg"}, {"gpg.passphrase": "${{ secrets.GPG_PASSWORD }}"}]' | |
- name: Setup gpg keyring | |
env: | |
GPG_FILE: ${{ secrets.GPG_FILE }} | |
run: mkdir ~/.gnupg && echo "$GPG_FILE" | base64 -d > ~/.gnupg/secring.gpg | |
- name: Set the current release version | |
id: release_version | |
run: echo "release_version=${GITHUB_REF:11}" >> $GITHUB_OUTPUT | |
- name: Setup git | |
env: | |
MICRONAUT_BUILD_EMAIL: ${{ secrets.MICRONAUT_BUILD_EMAIL }} | |
run: | | |
git config --global --add safe.directory /github/workspace | |
git config --global user.email "$MICRONAUT_BUILD_EMAIL" | |
git config --global user.name "micronaut-build" | |
echo "Checking out ${{ github.event.release.target_commitish }}" | |
git checkout ${{ github.event.release.target_commitish }} | |
git tag -d v${{ steps.release_version.outputs.release_version }} | |
git push origin :refs/tags/v${{ steps.release_version.outputs.release_version }} | |
- name: Setup SSH key | |
uses: webfactory/ssh-agent@v0.9.0 | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Figure out next version | |
id: next_version | |
run: | | |
wget -q https://raw.githubusercontent.com/micronaut-projects/github-actions/master/post-release/increment_version.sh -O /tmp/iv.sh | |
chmod +x /tmp/iv.sh | |
NV=`/tmp/iv.sh -p ${{ steps.release_version.outputs.release_version }}` | |
echo "next_version=${NV}-SNAPSHOT" >> $GITHUB_OUTPUT | |
- name: Prepare release | |
run: | | |
./mvnw --batch-mode release:prepare -DreleaseVersion=${{ steps.release_version.outputs.release_version }} -Dtag=v${{ steps.release_version.outputs.release_version }} -DdevelopmentVersion=${{ steps.next_version.outputs.next_version }} -Darguments="-Dinvoker.skip=true" | |
cp -R target/site/apidocs/* micronaut-maven-plugin/target/site/apidocs | |
- name: Publish to Github Pages | |
uses: micronaut-projects/github-pages-deploy-action@master | |
env: | |
BETA: ${{ contains(steps.release_version.outputs.release_version, 'M') || contains(steps.release_version.outputs.release_version, 'RC') }} | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
BRANCH: gh-pages | |
FOLDER: micronaut-maven-plugin/target/site | |
VERSION: ${{ steps.release_version.outputs.release_version }} | |
TARGET_REPOSITORY: ${{ github.repository }} | |
- name: Perform release | |
run: ./mvnw --batch-mode release:perform -Darguments="-Dinvoker.skip=true" | |
env: | |
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }} | |
- name: Close release | |
if: success() | |
run: | | |
release_url=`cat $GITHUB_EVENT_PATH | jq '.release.url' | sed -e 's/^"\(.*\)"$/\1/g'` | |
echo $release_url | |
curl -s --request PATCH -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -H "Content-Type: application/json" $release_url --data "{\"draft\": false}" | |
- name: Rollback release | |
if: failure() | |
run: ./mvnw release:rollback | |
- name: Close milestone ${{ steps.release_version.outputs.release_version }} | |
if: success() | |
uses: Beakyn/gha-close-milestone@v1.1.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
with: | |
repository: ${{ github.repository }} | |
milestone-title: ${{ steps.release_version.outputs.release_version }} |