From d23dc2a643751aaba57c27f22bef921bcb0b7bbc Mon Sep 17 00:00:00 2001 From: Anoop Panicker Date: Fri, 9 Apr 2021 00:24:31 -0700 Subject: [PATCH] added publish workflow --- .github/release-drafter.yml | 6 ++-- .github/workflows/ci.yml | 15 ++++++++-- .github/workflows/publish.yml | 50 ++++++++++++++++++++++++++++++++++ .travis.yml => .travis.yml.bak | 0 4 files changed, 65 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/publish.yml rename .travis.yml => .travis.yml.bak (100%) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 23aa220a2f..d25e47e852 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -12,9 +12,9 @@ categories: - title: 'New' label: 'type: feature' - title: 'Bug Fixes' - labels: - - 'type: bug' - - 'type: maintenance' + label: 'type: bug' + - title: 'Refactor' + label: 'type: maintenance' - title: 'Documentation' label: 'type: docs' - title: 'Dependency Updates' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 70d9a3a37e..46d9ad7411 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,4 @@ -# This workflow will build the project - -name: CI +name: Continuous Integration Workflow on: [ push, pull_request ] @@ -27,6 +25,17 @@ jobs: restore-keys: | ${{ runner.os }}-gradle- - name: Build with Gradle + if: github.ref != 'refs/heads/main' run: | echo "Running build for commit ${{ github.sha }} in ${{ github.head_ref }}" ./gradlew build --stacktrace + - name: Build and Publish snapshot + if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' + run: | + echo "Running build for commit ${{ github.sha }}" + ./gradlew build snapshot --stacktrace + env: + NETFLIX_OSS_SIGNING_KEY: ${{ secrets.ORG_SIGNING_KEY }} + NETFLIX_OSS_SIGNING_PASSWORD: ${{ secrets.ORG_SIGNING_PASSWORD }} + NETFLIX_OSS_REPO_USERNAME: ${{ secrets.ORG_NETFLIXOSS_USERNAME }} + NETFLIX_OSS_REPO_PASSWORD: ${{ secrets.ORG_NETFLIXOSS_PASSWORD }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000000..3469f61d6c --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,50 @@ +name: Publish to NetflixOSS and Maven Central +on: + release: + types: + - released + - prereleased + +jobs: + publish: + runs-on: ubuntu-latest + name: Gradle Build and Publish + steps: + - uses: actions/checkout@v2 + - name: Setup jdk 8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Cache Gradle packages + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Publish candidate + if: | + startsWith(github.ref, 'refs/tags/v') && + contains(github.ref, '-rc.') + run: ./gradlew --stacktrace -Prelease.useLastTag=true candidate + env: + NETFLIX_OSS_SONATYPE_USERNAME: ${{ secrets.ORG_SONATYPE_USERNAME }} + NETFLIX_OSS_SONATYPE_PASSWORD: ${{ secrets.ORG_SONATYPE_PASSWORD }} + NETFLIX_OSS_SIGNING_KEY: ${{ secrets.ORG_SIGNING_KEY }} + NETFLIX_OSS_SIGNING_PASSWORD: ${{ secrets.ORG_SIGNING_PASSWORD }} + NETFLIX_OSS_REPO_USERNAME: ${{ secrets.ORG_NETFLIXOSS_USERNAME }} + NETFLIX_OSS_REPO_PASSWORD: ${{ secrets.ORG_NETFLIXOSS_PASSWORD }} + - name: Publish release + if: | + startsWith(github.ref, 'refs/tags/v') && + (!contains(github.ref, '-rc.')) + run: ./gradlew --stacktrace -Prelease.useLastTag=true final + env: + NETFLIX_OSS_SONATYPE_USERNAME: ${{ secrets.ORG_SONATYPE_USERNAME }} + NETFLIX_OSS_SONATYPE_PASSWORD: ${{ secrets.ORG_SONATYPE_PASSWORD }} + NETFLIX_OSS_SIGNING_KEY: ${{ secrets.ORG_SIGNING_KEY }} + NETFLIX_OSS_SIGNING_PASSWORD: ${{ secrets.ORG_SIGNING_PASSWORD }} + NETFLIX_OSS_REPO_USERNAME: ${{ secrets.ORG_NETFLIXOSS_USERNAME }} + NETFLIX_OSS_REPO_PASSWORD: ${{ secrets.ORG_NETFLIXOSS_PASSWORD }} diff --git a/.travis.yml b/.travis.yml.bak similarity index 100% rename from .travis.yml rename to .travis.yml.bak