Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions .github/workflows/release-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
# releases the project with specified version
# deploys it to the sonatype staging repo
name: Release and deploy to Sonatype staging repo

env:
GITHUB_PAT: ${{ secrets.QUDTLIB_BOT_GITHUB_TOKEN }}
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

on:
workflow_dispatch:
inputs:
Expand All @@ -32,6 +34,9 @@ on:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write

steps:
- name: Check write access to repo
Expand All @@ -54,24 +59,25 @@ jobs:
tag: v${{ inputs.release_version }}
env:
GITHUB_TOKEN: ${{ secrets.QUDTLIB_BOT_GITHUB_TOKEN }}

- name: Fail if tag v${{ inputs.release_version }} exists
if: steps.checkTag.outputs.exists == 'true'
run: |
echo Tag v${{ inputs.release_version }} already exists, release aborted >> $GITHUB_STEP_SUMMARY
exit 1

# Set up java with maven cache
- uses: actions/checkout@v6
- name: Set up JDK 21
uses: actions/setup-java@v5
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '21'
cache: 'maven'

# import the secret key
- name: Set up Apache Maven Central
uses: actions/setup-java@v5
uses: actions/setup-java@v3
with: # running setup-java again overwrites the settings.xml
distribution: 'temurin'
java-version: '21'
Expand Down Expand Up @@ -143,6 +149,11 @@ jobs:
version: ${{ inputs.release_version }}
operation: read

# configure git
- name: setup git token
run: |
git config --global url."https://x-access-token:${{ secrets.QUDTLIB_BOT_GITHUB_TOKEN }}@github.com/".insteadOf https://github.com/

# create the pull request
- name: Create Pull Request
uses: peter-evans/create-pull-request@v8
Expand All @@ -167,8 +178,8 @@ jobs:
# Next Steps

Please rebase this PR on top of `main` after publishing the release via the
[Sonatype Repository Manager](https://central.sonatype.com/publishing/deployments).
[Sonatype Repository Manager](https://central.sonatype.com/publishing/deployments).

# print the summary
- name: Print summary
run: echo "Release ${{ inputs.release_version }} deployed to sonatype staging repo. Please go there, close the repo and publish it." >> $GITHUB_STEP_SUMMARY
run: echo "Release ${{ inputs.release_version }} deployed to sonatype staging repo. Please go there, close the repo and publish it." >> $GITHUB_STEP_SUMMARY
Loading