11 - uses: actions/checkout@v2.3.4
13 uses: actions/setup-java@v2
15 java-version: ${{ env.JAVA }}
18 server-username: MAVEN_CENTRAL_USERNAME
19 server-password: MAVEN_CENTRAL_TOKEN
20 - uses: actions/cache@v2.1.5
22 path: ~/.m2/repository
23 key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
25 ${{ runner.os }}-maven-
26 - name: Create Release Version
28 run: echo "::set-output name=version::$(date +'%Y.%-m.%-d')"
29 - name: Count commits in last week
31 run: echo "::set-output name=count::$(git rev-list --count HEAD --since='last Tuesday')"
32 - name: Set release version
33 run: mvn --batch-mode versions:set -DnewVersion=${{ steps.release.outputs.version }} -DgenerateBackupPoms=false
36 run: echo "${{ secrets.GPG_SECRET_KEY_BASE64 }}" | base64 --decode > $GITHUB_WORKSPACE/signing.key.asc
37 - name: Publish to Maven Central
38 if: steps.commits.outputs.count > 0
39 run: MAVEN_OPTS="--add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED" mvn --batch-mode --activate-profiles release verify deploy -Dpgp.secretkey=keyfile:$GITHUB_WORKSPACE/signing.key.asc -Dpgp.passphrase=literal:${{ secrets.GPG_SECRET_KEY_PASSWORD }}
41 MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
42 MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
43 - name: Create Release
44 if: steps.commits.outputs.count > 0
46 uses: actions/create-release@v1.1.4
48 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50 tag_name: ${{ steps.release.outputs.version }}
51 release_name: Release ${{ steps.release.outputs.version }}
55 Automated release, see [commits](https://github.com/metio/reguloj/commits/${{ steps.release.outputs.version }}) for changes. **Requires at least Java ${{ env.JAVA }}**.
57 Include this project as a Maven dependency:
60 <groupId>wtf.metio.reguloj</groupId>
61 <artifactId>reguloj</artifactId>
62 <version>${{ steps.release.outputs.version }}</version>
66 Or like this in case you are using Gradle (Kotlin):
69 implementation("wtf.metio.reguloj:reguloj:${{ steps.release.outputs.version }}") {
70 because("we want to use a lightweight rule engine")
74 Take a look the [information](https://search.maven.org/artifact/wtf.metio.reguloj/reguloj/${{ steps.release.outputs.version }}/jar) available at Maven Central for other build tools.
76 if: steps.commits.outputs.count > 0
77 uses: dawidd6/action-send-mail@v3.1.0
79 server_address: ${{ secrets.MAIL_SERVER }}
80 server_port: ${{ secrets.MAIL_PORT }}
81 username: ${{ secrets.MAIL_USERNAME }}
82 password: ${{ secrets.MAIL_PASSWORD }}
83 subject: reguloj release ${{ steps.release.outputs.version }}
84 body: See https://github.com/metio/reguloj/releases/tag/${{ steps.release.outputs.version }} for details.
85 to: reguloj@metio.groups.io
86 from: ${{ secrets.MAIL_SENDER }}
88 name: Send Matrix Message
89 uses: s3krit/matrix-message-action@v0.0.3
91 room_id: ${{ secrets.MATRIX_ROOM_ID }}
92 access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
93 message: "release [${{ steps.release.outputs.version }}](https://github.com/metio/reguloj/releases/tag/${{ steps.release.outputs.version }}) published"