[Build] Enable sonatype publish (#254)

* [Build] Enable sonatype publish

Other prep for 0.1.0 release:
- special case 0.1.0 to avoid creating release branch
- minor format and name improvements in ci.yml

* [Build] Improve format of prepare-release.yml

* [Build] Exclude .github from PR workflow
This commit is contained in:
Chris Bono
2022-12-13 14:52:34 -06:00
committed by GitHub
parent caf8cf71ff
commit ca741d8871
3 changed files with 41 additions and 22 deletions

View File

@@ -18,6 +18,7 @@ env:
jobs:
build_and_deploy:
name: Build and Deploy
if: github.repository == 'spring-projects-experimental/spring-pulsar'
runs-on: ubuntu-latest
outputs:
@@ -41,7 +42,7 @@ jobs:
- name: Run Gradle build
run: |
./gradlew clean build --continue -PartifactoryUsername="$ARTIFACTORY_USERNAME" -PartifactoryPassword="$ARTIFACTORY_PASSWORD"
- name: Capture Test Results
- name: Capture test results
if: failure()
uses: actions/upload-artifact@v3
with:
@@ -50,14 +51,20 @@ jobs:
retention-days: 3
- name: Deploy artifacts
run: |
./gradlew publishArtifact -PartifactoryUsername="$ARTIFACTORY_USERNAME" -PartifactoryPassword="$ARTIFACTORY_PASSWORD" -PossrhUsername="$OSSRH_TOKEN_USERNAME" -PossrhPassword="$OSSRH_TOKEN_PASSWORD" --stacktrace
./gradlew publishArtifacts -PossrhUsername="$OSSRH_TOKEN_USERNAME" -PossrhPassword="$OSSRH_TOKEN_PASSWORD" -PartifactoryUsername="$ARTIFACTORY_USERNAME" -PartifactoryPassword="$ARTIFACTORY_PASSWORD" --stacktrace
env:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSPHRASE }}
OSSRH_TOKEN_USERNAME: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }}
OSSRH_TOKEN_PASSWORD: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }}
- id: extract_version
name: Extract current version
run: |
version=$(cat gradle.properties | grep "version=" | awk -F'=' '{print $2}')
echo "::set-output name=project_version::$version"
perform_release:
name: Perform release
name: Perform Release
needs: [build_and_deploy]
runs-on: ubuntu-latest
permissions:
@@ -78,7 +85,8 @@ jobs:
with:
java-version: '17'
distribution: 'temurin'
- name: Wait for Artifactory Artifacts
- name: Wait for Artifactory artifacts (milestone)
if: ${{ contains(needs.build_and_deploy.outputs.project_version, '-RC') || contains(needs.build_and_deploy.outputs.project_version, '-M') }}
run: |
echo "Wait for artifacts of $REPO@$VERSION to appear on Artifactory."
@@ -88,7 +96,8 @@ jobs:
echo "."
done
echo "Artifacts for $REPO@$VERSION have been released to Artifactory."
- name: Wait for Maven Central Artifacts
- name: Wait for Maven Central artifacts (GA)
if: ${{ !contains(needs.build_and_deploy.outputs.project_version, '-SNAPSHOT') && !contains(needs.build_and_deploy.outputs.project_version, '-RC') && !contains(needs.build_and_deploy.outputs.project_version, '-M') }}
run: |
echo "Wait for artifacts of $REPO@$VERSION to appear on Maven Central."
@@ -98,28 +107,30 @@ jobs:
echo "."
done
echo "Artifacts for $REPO@$VERSION have been released to Maven Central."
- name: Setup git config
- name: Setup git for release tagging
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
- name: Tag Release
if: ${{ contains(needs.build_and_deploy.outputs.project_version, '-RC') || contains(needs.build_and_deploy.outputs.project_version, '-M') }}
- name: Tag release (milestone)
if: ${{ needs.build_and_deploy.outputs.project_version == '0.1.0' || contains(needs.build_and_deploy.outputs.project_version, '-RC') || contains(needs.build_and_deploy.outputs.project_version, '-M') }}
run: |
echo "Tagging $REPO@$VERSION release."
git tag v$VERSION
git push --tags origin
- name: Create Branch and Tag Release
if: ${{ !contains(needs.build_and_deploy.outputs.project_version, '-RC') && !contains(needs.build_and_deploy.outputs.project_version, '-M') }}
- name: Create branch and tag release (GA)
if: ${{ needs.build_and_deploy.outputs.project_version != '0.1.0' && !contains(needs.build_and_deploy.outputs.project_version, '-RC') && !contains(needs.build_and_deploy.outputs.project_version, '-M') }}
run: |
echo "Tagging $REPO@$VERSION and creating release branch."
git checkout -b $VERSION
git push origin $VERSION
git tag v$VERSION
git push --tags origin
- name: Install Tooling
- name: Install tooling for Github release
run: |
curl -sSL https://github.com/cbroglie/mustache/releases/download/v1.2.2/mustache_1.2.2_linux_amd64.tar.gz | sudo tar -C /usr/local/bin/ --no-same-owner -xzv mustache
- name: Create Github Release
- name: Create Github release
env:
RELEASE_NOTES_ISSUES: ${{runner.temp}}/release_notes_issues.json
RELEASE_NOTES_FILE: ${{runner.temp}}/release_notes.md5
@@ -137,7 +148,8 @@ jobs:
--title "Spring Pulsar $VERSION" \
--generate-notes \
--notes-file $RELEASE_NOTES_FILE
- name: Update to next Snapshot Version
- name: Update next snapshot version
run: |
echo "Updating $REPO@$VERSION to next snapshot version."
./gradlew :updateToSnapshotVersion