|
| 1 | +name: Release |
| 2 | + |
| 3 | +# Runs manually |
| 4 | +on: |
| 5 | + workflow_dispatch |
| 6 | + |
| 7 | +jobs: |
| 8 | + release: |
| 9 | + name: Release on Sonatype OSS |
| 10 | + runs-on: ubuntu-latest |
| 11 | + |
| 12 | + steps: |
| 13 | + - name: Checkout |
| 14 | + uses: actions/checkout@v3 |
| 15 | + with: |
| 16 | + submodules: recursive |
| 17 | + |
| 18 | + - name: Set up Apache Maven Central |
| 19 | + uses: actions/setup-java@v3 |
| 20 | + with: |
| 21 | + java-version: 11 |
| 22 | + distribution: 'temurin' |
| 23 | + cache: 'maven' |
| 24 | + gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import |
| 25 | + gpg-passphrase: GPG_PASSPHRASE # env variable for GPG private key passphrase |
| 26 | + |
| 27 | + - name: Publish to Apache Maven Central |
| 28 | + run: | |
| 29 | + maven_config="$(cat .mvn/maven.config)" |
| 30 | + current_version="${maven_config/#*-Drevision=}" |
| 31 | + current_version="${current_version/ */}" |
| 32 | + next_version="${current_version/-SNAPSHOT/}" |
| 33 | + sed -i "s/${current_version}/${next_version}/" .mvn/maven.config |
| 34 | + git config --global user.email ${{ secrets.BUILD_USER_EMAIL }} |
| 35 | + git config --global user.name ${{ secrets.BUILD_USER }} |
| 36 | + git add -f .mvn/maven.config |
| 37 | + git commit -m "set release version to ${next_version}" |
| 38 | + git tag -a "release/${next_version}" -m "tagged version ${next_version}" |
| 39 | + mvn --settings .mvn/settings.xml deploy -Pdeploy -Dgpg.pin.entry.mode=loopback -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} |
| 40 | + env: |
| 41 | + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} |
| 42 | + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} |
| 43 | + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} |
| 44 | + |
| 45 | + - name: set next version & create gitHub release |
| 46 | + run: | |
| 47 | + maven_config="$(cat .mvn/maven.config)" |
| 48 | + current_version="${maven_config/#*-Drevision=}" |
| 49 | + current_version="${current_version/ */}" |
| 50 | + current_segment="${current_version/*./}" |
| 51 | + (( next_segment=${current_segment}+1 )) |
| 52 | + while [ ${#next_segment} -ne 3 ]; do next_segment="0${next_segment}"; done |
| 53 | + next_version="${current_version%.*}.${next_segment}-SNAPSHOT" |
| 54 | + sed -i "s/${current_version}/${next_version}/" .mvn/maven.config |
| 55 | + git add -f .mvn/maven.config |
| 56 | + git commit -m "set next version to ${next_version}" |
| 57 | + git push |
| 58 | + git push --tags |
| 59 | + noDotVersion="${current_version//.}" |
| 60 | + gh release create "release/${current_version}" --title "${current_version}" --notes "# Download |
| 61 | + https://repo1.maven.org/maven2/com/devonfw/tools/ide/devonfw-ide-scripts/${old_version}/devonfw-ide-scripts-${current_version}.tar.gz |
| 62 | + # Changes |
| 63 | + https://github.com/devonfw/ide/blob/master/CHANGELOG.asciidoc#${noDotVersion}" |
| 64 | + env: |
| 65 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments