Update publish.yaml #48
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
name: Build and Test | |
on: [push, pull_request] | |
env: | |
MAVEN_USER: adtran | |
MAVEN_SYNC: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # unlimited | |
- name: Set up JDK | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '8' | |
distribution: 'adopt' | |
- name: Build with Gradle | |
run: > | |
./gradlew build cobertura | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.ref == 'refs/heads/main' | |
environment: publish | |
env: | |
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} | |
ORG_GRADLE_PROJECT_signingKeyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # unlimited | |
- name: Set up JDK | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '8' | |
distribution: 'adopt' | |
- name: Publish to plugins.gradle.org | |
id: publish_to_gradle | |
run: > | |
./gradlew publishPlugins | |
-Pgradle.publish.secret=${{ secrets.GRADLE_PUBLISH_SECRET }} | |
-Pgradle.publish.key=${{ secrets.GRADLE_PUBLISH_KEY }} | |
- name: Publish to OSSRH | |
id: publish_to_ossrh | |
run: > | |
./gradlew publishScalaMultiVersionPublicationToOssrhRepository | |
-PossrhUsername=${{ secrets.OSSRH_USERNAME }} | |
-PossrhPassword=${{ secrets.OSSRH_PASSWORD }} | |
- name: Tag | |
if: > | |
${{ | |
steps.publish_to_gradle.conclusion == 'success' || | |
steps.publish_to_ossrh.conclusion == 'success' | |
}} | |
run: | | |
version=$(./gradlew --quiet printVersion) | |
tag=v$version | |
git config --global user.name 'Github Actions' | |
git config --global user.email '[email protected]' | |
git tag -m "automatic tag for $version" "$tag" | |
git push origin "$tag" |