Repository navigation
Release v5.4.2 #32
Workflow file for this run
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
| name: Release | |
| on: | |
| pull_request: | |
| types: [closed] | |
| branches: | |
| - main | |
| jobs: | |
| release: | |
| if: github.event.pull_request.merged == true # only run if PR was merged | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # needed for release + deleting branches | |
| pages: write # needed to publish to GitHub Pages | |
| id-token: write # required for GitHub Pages deployment | |
| packages: write # needed for Maven Central deploy | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v7 | |
| - name: Set up Java | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: 17 | |
| cache: maven | |
| server-id: central | |
| server-username: MAVEN_USERNAME | |
| server-password: MAVEN_PASSWORD | |
| - name: Import GPG key | |
| run: | | |
| mkdir -p ~/.gnupg | |
| chmod 700 ~/.gnupg | |
| echo "$GPG_PRIVATE_KEY" | gpg --batch --import | |
| env: | |
| GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | |
| - name: Deploy to Maven Central (signed) | |
| run: mvn -B clean deploy -Pcentral -Dgpg.executable=gpg | |
| env: | |
| MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | |
| MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} | |
| MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| - name: Build NRW jar | |
| # The NRW build returns the List of the NRW Zentralabitur from find, | |
| # getAll and getTouchingSprites. It is only offered as a download, and | |
| # the next step cleans target/, so the jars are put aside first. | |
| run: | | |
| mvn -B clean package -Pall,nrw | |
| mkdir -p dist | |
| cp target/*-nrw-all.jar target/*-nrw-sources.jar dist/ | |
| - name: Build fat jar | |
| # Tests already ran as part of the deploy step above; skip them here | |
| # to avoid paying for the full suite twice in the same job. | |
| run: mvn -B clean package -Pall -DskipTests | |
| - name: Get project version | |
| id: get-version | |
| run: | | |
| VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| echo "Detected version: $VERSION" | |
| - name: Take the release notes from CHANGELOG.md | |
| # The notes are the version's entry in the changelog, which the version | |
| # bump wrote from the changesets. Not the merged PR's description: when a | |
| # release run fails, the PR that fixes it is the one that releases. | |
| run: | | |
| awk -v heading="## $VERSION" ' | |
| $0 == heading { found = 1; next } | |
| found && /^## / { exit } | |
| found { print } | |
| ' CHANGELOG.md | sed -e '/./,$!d' | sed -e ':a' -e '/^\n*$/{$d;N;ba' -e '}' > "$RUNNER_TEMP/release-notes.md" | |
| if [ ! -s "$RUNNER_TEMP/release-notes.md" ]; then | |
| echo "Automated release of version $VERSION" > "$RUNNER_TEMP/release-notes.md" | |
| fi | |
| cat "$RUNNER_TEMP/release-notes.md" | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v3 | |
| with: | |
| tag_name: v${{ env.VERSION }} | |
| name: v${{ env.VERSION }} | |
| body_path: ${{ runner.temp }}/release-notes.md | |
| files: | | |
| target/*.jar | |
| dist/*.jar | |
| - name: Delete changeset branch | |
| run: | | |
| echo "Deleting branch 'changeset'" | |
| git push origin --delete changeset || true | |