-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
96d933f
commit 1598435
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Publish Passage Package | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v2 | ||
with: | ||
distribution: 'adopt' | ||
java-version: '17' | ||
|
||
- name: Set up GPG | ||
env: | ||
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | ||
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | ||
run: | | ||
echo "$GPG_PRIVATE_KEY" | gpg --batch --import | ||
echo "signing.gnupg.keyName=${{ secrets.GPG_KEY_NAME }}" >> gradle.properties | ||
echo "signing.gnupg.passphrase=${{ secrets.GPG_PASSPHRASE }}" >> gradle.properties | ||
- name: Publish to Maven Central | ||
run: ./gradlew :passage:publish | ||
|
||
- name: Wait for Staging Repository to be Created | ||
run: sleep 60 | ||
|
||
- name: Get Staging Repository ID | ||
id: get_repo_id | ||
env: | ||
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | ||
run: | | ||
response=$(curl -u ${{ secrets.OSSRH_USERNAME }}:${{ secrets.OSSRH_PASSWORD }} -X GET "https://s01.oss.sonatype.org/service/local/staging/profile_repositories") | ||
repo_id=$(echo $response | jq -r '.data[] | select(.repositoryType=="open") | .repositoryId') | ||
echo "::set-output name=repo_id::$repo_id" | ||
- name: Close and Release Repository | ||
env: | ||
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | ||
run: | | ||
repo_id=${{ steps.get_repo_id.outputs.repo_id }} | ||
curl -u ${{ secrets.OSSRH_USERNAME }}:${{ secrets.OSSRH_PASSWORD }} \ | ||
-X POST https://s01.oss.sonatype.org/service/local/staging/bulk/close \ | ||
-H "Content-Type: application/xml" \ | ||
-d "<promoteRequest><data><stagedRepositoryId>$repo_id</stagedRepositoryId></data></promoteRequest>" | ||
# Wait for repository to close | ||
sleep 60 | ||
curl -u ${{ secrets.OSSRH_USERNAME }}:${{ secrets.OSSRH_PASSWORD }} \ | ||
-X POST https://s01.oss.sonatype.org/service/local/staging/bulk/promote \ | ||
-H "Content-Type: application/xml" \ | ||
-d "<promoteRequest><data><stagedRepositoryId>$repo_id</stagedRepositoryId></data></promoteRequest>" |