|
1 | 1 | name: Release |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - branches: [ master ] |
| 4 | + workflow_dispatch: |
6 | 5 |
|
7 | 6 | jobs: |
8 | | - Release: |
| 7 | + release: |
9 | 8 | runs-on: ubuntu-latest |
10 | | - if: github.event_name == 'push' && startsWith(github.event.head_commit.message, '[release]') |
11 | 9 | steps: |
12 | 10 | - name: Checkout |
13 | 11 | uses: actions/checkout@v6 |
14 | 12 |
|
15 | 13 | - name: Setup Java |
16 | 14 | uses: actions/setup-java@v5 |
17 | 15 | with: |
18 | | - java-version: 1.8 |
| 16 | + java-version: 21 |
19 | 17 | distribution: zulu |
20 | | - server-id: central |
21 | | - server-username: MAVEN_USERNAME |
22 | | - server-password: MAVEN_CENTRAL_TOKEN |
23 | | - gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} |
24 | | - gpg-passphrase: MAVEN_GPG_PASSPHRASE |
25 | 18 | cache: maven |
26 | 19 |
|
27 | 20 | - name: Build |
28 | | - run: | |
29 | | - chmod +x mvnw |
30 | | - ./mvnw -Pit -B verify --file pom.xml |
| 21 | + run: ./mvnw -ntp -B verify |
31 | 22 |
|
32 | 23 | - name: Release |
| 24 | + run: | |
| 25 | + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 26 | + git config --global user.name "GitHub Action" |
| 27 | + git config --global url."https://x-access-token:${JRELEASER_GITHUB_TOKEN}@github.com/".insteadOf "git@github.com:" |
| 28 | + ./mvnw -ntp -B -Prelease release:prepare release:perform |
33 | 29 | env: |
34 | | - MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }} |
35 | | - MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_PASSWORD }} |
36 | | - MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} |
| 30 | + JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.JRELEASER_MAVENCENTRAL_USERNAME }} |
| 31 | + JRELEASER_MAVENCENTRAL_TOKEN: ${{ secrets.JRELEASER_MAVENCENTRAL_TOKEN }} |
| 32 | + JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }} |
| 33 | + JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }} |
| 34 | + JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }} |
| 35 | + JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 36 | + |
| 37 | + - name: JReleaser output |
| 38 | + if: always() |
| 39 | + uses: actions/upload-artifact@v6 |
| 40 | + with: |
| 41 | + name: jreleaser-release |
| 42 | + path: | |
| 43 | + target/jreleaser/trace.log |
| 44 | + target/jreleaser/output.properties |
| 45 | +
|
| 46 | + - name: Update pom |
37 | 47 | run: | |
38 | | - git config user.name "${{ github.event.head_commit.committer.name }}" |
39 | | - git config user.email "${{ github.event.head_commit.committer.email }}" |
40 | | - ./mvnw -B --file pom.xml release:prepare release:perform -Drepository.url=https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git |
| 48 | + sed -i -e "s@project.build.outputTimestamp>.*</project.build.outputTimestamp@project.build.outputTimestamp>\${git.commit.author.time}</project.build.outputTimestamp@g" pom.xml |
| 49 | + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 50 | + git config --global user.name "GitHub Action" |
| 51 | + git commit -a -m "build: Update timestamp expression" |
| 52 | + git push origin master |
0 commit comments