Automated Release #82
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SPDX-FileCopyrightText: The devcontainer.java Authors | |
| # SPDX-License-Identifier: 0BSD | |
| name: Automated Release | |
| on: | |
| schedule: | |
| - cron: 35 5 * * FRI | |
| workflow_dispatch: | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - id: checkout | |
| name: Clone Git Repository | |
| uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - id: last_release | |
| name: Fetch last release info | |
| run: echo "tag=$(gh release view --json tagName --jq '.tagName')" >> $GITHUB_OUTPUT | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - id: commits | |
| name: Count Commits | |
| run: echo "count=$(git rev-list --count ${{ steps.last_release.outputs.tag }}..HEAD -- src/main/java pom.xml)" >> $GITHUB_OUTPUT | |
| - id: release | |
| name: Create Release Version | |
| if: steps.commits.outputs.count > 0 | |
| run: echo "version=$(date +'%Y.%-m.%-d')" >> $GITHUB_OUTPUT | |
| - id: sha | |
| name: Last Commit | |
| if: steps.commits.outputs.count > 0 | |
| run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
| - id: timestamp | |
| name: Build Timestamp | |
| if: steps.commits.outputs.count > 0 | |
| run: echo "iso8601=$(date --utc --iso-8601=seconds)" >> $GITHUB_OUTPUT | |
| - id: setup-java | |
| name: Set up Java | |
| if: steps.commits.outputs.count > 0 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: 25 | |
| distribution: temurin | |
| cache: maven | |
| server-id: central | |
| server-username: MAVEN_CENTRAL_USERNAME | |
| server-password: MAVEN_CENTRAL_TOKEN | |
| - id: gpg | |
| name: GPG Key | |
| if: steps.commits.outputs.count > 0 | |
| uses: timheuer/base64-to-file@v2 | |
| with: | |
| fileName: signing.key.asc | |
| fileDir: ${{ github.workspace }} | |
| encodedString: ${{ secrets.GPG_SECRET_KEY_BASE64 }} | |
| - id: pom-version | |
| name: Set Release Version | |
| if: steps.commits.outputs.count > 0 | |
| run: mvn --batch-mode --define newVersion=${{ steps.release.outputs.version }} --define generateBackupPoms=false versions:set | |
| - id: deploy-maven | |
| name: Deploy Maven Artifact | |
| if: steps.commits.outputs.count > 0 | |
| run: > | |
| mvn | |
| --batch-mode | |
| --activate-profiles release | |
| --define scmTag=${{ steps.sha.outputs.sha }} | |
| --define sign.keyFile=${{ steps.gpg.outputs.filePath }} | |
| --define sign.keyPass=${{ secrets.GPG_SECRET_KEY_PASSWORD }} | |
| --define project.build.outputTimestamp=${{ steps.timestamp.outputs.iso8601 }} | |
| deploy | |
| env: | |
| MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} | |
| MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} | |
| - id: create_release | |
| name: Create Release | |
| if: steps.commits.outputs.count > 0 | |
| uses: softprops/action-gh-release@v3 | |
| with: | |
| tag_name: ${{ steps.release.outputs.version }} | |
| name: ${{ steps.release.outputs.version }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true |