|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + version: |
| 7 | + description: "Release version" |
| 8 | + required: true |
| 9 | + branch: |
| 10 | + description: "Git branch" |
| 11 | + required: true |
| 12 | +jobs: |
| 13 | + release: |
| 14 | + name: Release |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - name: Checkout |
| 18 | + uses: actions/checkout@v3 |
| 19 | + with: |
| 20 | + ref: ${{ github.event.inputs.branch }} |
| 21 | + fetch-depth: 0 |
| 22 | + |
| 23 | + - name: Set up Java |
| 24 | + uses: actions/setup-java@v1 |
| 25 | + with: |
| 26 | + java-version: 18 |
| 27 | + |
| 28 | + - uses: actions/cache@v2 |
| 29 | + with: |
| 30 | + path: ~/.m2/repository |
| 31 | + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} |
| 32 | + restore-keys: | |
| 33 | + ${{ runner.os }}-maven- |
| 34 | +
|
| 35 | + - name: Set release version |
| 36 | + run: | |
| 37 | + VERSION=${{ github.event.inputs.version }} |
| 38 | + ./mvnw versions:set -DnewVersion=$VERSION |
| 39 | +
|
| 40 | + - name: Build |
| 41 | + run: ./mvnw --no-transfer-progress -B --file pom.xml verify |
| 42 | + |
| 43 | + - name: Show Reports |
| 44 | + uses: actions/upload-artifact@v1 |
| 45 | + if: failure() |
| 46 | + with: |
| 47 | + name: reports-${{ runner.os }} |
| 48 | + path: target/ |
| 49 | + |
| 50 | + - name: Release |
| 51 | + uses: jreleaser/release-action@v1 |
| 52 | + env: |
| 53 | + JRELEASER_PROJECT_VERSION: ${{ github.event.inputs.version }} |
| 54 | + JRELEASER_GITHUB_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }} |
| 55 | + JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} |
| 56 | + JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY}} |
| 57 | + JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} |
| 58 | + JRELEASER_SLACK_WEBHOOK: ${{ secrets.JRELEASER_SLACK_WEBHOOK }} |
| 59 | + |
| 60 | + - name: Commit release version |
| 61 | + run: | |
| 62 | + VERSION=${{ github.event.inputs.version }} |
| 63 | + sed -i -e "s/^\:project-version\:\ .*/:project-version: $VERSION/g" README.adoc |
| 64 | + git add README.adoc |
| 65 | + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 66 | + git config --global user.name "GitHub Action" |
| 67 | + git commit -a -m "Releasing version $VERSION" |
| 68 | + git push origin ${{ github.event.inputs.branch }} |
| 69 | +
|
| 70 | + - name: JReleaser output |
| 71 | + if: always() |
| 72 | + uses: actions/upload-artifact@v2 |
| 73 | + with: |
| 74 | + name: artifact |
| 75 | + path: | |
| 76 | + out/jreleaser/trace.log |
| 77 | + out/jreleaser/output.properties |
0 commit comments