1 # SPDX-FileCopyrightText: The Storage-Units Authors
2 # SPDX-License-Identifier: 0BSD
4 name: Automated Release
10 runs-on: ubuntu-latest
12 - uses: actions/checkout@v3
14 uses: actions/setup-java@v3
19 server-username: MAVEN_CENTRAL_USERNAME
20 server-password: MAVEN_CENTRAL_TOKEN
21 - uses: actions/cache@v3
23 path: ~/.m2/repository
24 key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
26 ${{ runner.os }}-maven-
27 - name: Create release version
29 run: echo "::set-output name=version::$(date +'%Y.%-m.%-d')"
30 - name: Count commits in last week
32 run: echo "::set-output name=count::$(git rev-list --count HEAD --since='last Tuesday')"
33 - name: Set release version
34 run: mvn --batch-mode versions:set -DnewVersion=${{ steps.release.outputs.version }} -DgenerateBackupPoms=false
36 if: steps.commits.outputs.count > 0
38 run: echo "${{ secrets.GPG_SECRET_KEY_BASE64 }}" | base64 --decode > $GITHUB_WORKSPACE/signing.key.asc
39 - name: Publish to Maven Central
40 if: steps.commits.outputs.count > 0
41 run: mvn --batch-mode --activate-profiles release deploy -Dpgp.secretkey=keyfile:$GITHUB_WORKSPACE/signing.key.asc -Dpgp.passphrase=literal:${{ secrets.GPG_SECRET_KEY_PASSWORD }}
43 MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
44 MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
45 - name: Create Release
46 if: steps.commits.outputs.count > 0
48 uses: actions/create-release@v1.1.4
50 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52 tag_name: ${{ steps.release.outputs.version }}
53 release_name: ${{ steps.release.outputs.version }}
57 Automated release, see [commits](https://github.com/metio/storage-units/commits/${{ steps.release.outputs.version }}) for changes.