Repository navigation
Fix the release workflow broken by #36 #30
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: Create GitHub Release | |
| uses: softprops/action-gh-release@v3 | |
| with: | |
| tag_name: v${{ env.VERSION }} | |
| name: v${{ env.VERSION }} | |
| body: ${{ github.event.pull_request.body || format('Automated release of version {0}', env.VERSION) }} | |
| files: | | |
| target/*.jar | |
| dist/*.jar | |
| - name: Delete changeset branch | |
| run: | | |
| echo "Deleting branch 'changeset'" | |
| git push origin --delete changeset || true | |