From c6ca1351f9758b5d443cb1576a00841d1dfbe71a Mon Sep 17 00:00:00 2001 From: Christophe Carvalho Vilas-Boas Date: Sat, 24 Jul 2021 20:20:14 +0200 Subject: [PATCH 1/2] core: CI & CD --- .../workflows/{snapshot.yml => develop.yml} | 17 ++++++++++ .github/workflows/master.yml | 30 ++++++++++++++++- .github/workflows/release.yml | 32 ------------------- 3 files changed, 46 insertions(+), 33 deletions(-) rename .github/workflows/{snapshot.yml => develop.yml} (74%) delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/snapshot.yml b/.github/workflows/develop.yml similarity index 74% rename from .github/workflows/snapshot.yml rename to .github/workflows/develop.yml index 8113431..997987a 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/develop.yml @@ -6,8 +6,25 @@ on: - develop jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + java-package: jdk + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build with Gradle + run: ./gradlew build + publish-snapshot: + needs: build runs-on: ubuntu-latest steps: diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 1ff7482..cef8dbe 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -1,4 +1,4 @@ -name: Build and Coverage +name: Build, Coverage and Publish Release on: push: @@ -26,3 +26,31 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} file: ./Library/build/reports/jacoco/test/jacocoTestReport.xml + + publish-release: + + needs: build-and-coverage + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Gradle Maven Publish + run: | + ./gradlew publishMavenJavaPublicationToMavenRepository + env: + IS_RELEASE: "YES" + PGP_KEY: ${{ secrets.PGP_KEY }} + PGP_PWD: ${{ secrets.PGP_PWD }} + OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} + OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + - name: Gradle Plugin Publish + run: | + ./gradlew publishPlugins -Pgradle.publish.key=$GRADLE_PUBLISH_KEY -Pgradle.publish.secret=$GRADLE_PUBLISH_SECRET + env: + IS_RELEASE: "YES" + GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }} + GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 7ae570f..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Publish Release - -on: - push: - branches: - - release/* - -jobs: - publish-release: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - name: Gradle Maven Publish - run: | - ./gradlew publishMavenJavaPublicationToMavenRepository - env: - IS_RELEASE: "YES" - PGP_KEY: ${{ secrets.PGP_KEY }} - PGP_PWD: ${{ secrets.PGP_PWD }} - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} - - name: Gradle Plugin Publish - run: | - ./gradlew publishPlugins -Pgradle.publish.key=$GRADLE_PUBLISH_KEY -Pgradle.publish.secret=$GRADLE_PUBLISH_SECRET - env: - IS_RELEASE: "YES" - GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }} - GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }} From ee4ec7d58d5a96d933024ebeca1ef83c0204800e Mon Sep 17 00:00:00 2001 From: Christophe Carvalho Vilas-Boas Date: Sat, 24 Jul 2021 20:30:16 +0200 Subject: [PATCH 2/2] core: CI & CD --- .github/workflows/develop.yml | 5 ++--- .github/workflows/master.yml | 32 ++++++++++++++++---------------- README.md | 3 ++- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index 997987a..6f35ad6 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -1,9 +1,8 @@ -name: Publish Snapshot +name: Build and Publish Snapshot on: push: - branches: - - develop + branches: [ develop ] jobs: build: diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index cef8dbe..6aff882 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -10,22 +10,22 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - java-package: jdk - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Build with Gradle - run: ./gradlew build - - name: JaCoco Test Report - run: ./gradlew jacocoTestReport - - uses: codecov/codecov-action@v1 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: ./Library/build/reports/jacoco/test/jacocoTestReport.xml + - uses: actions/checkout@v2 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + java-package: jdk + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build with Gradle + run: ./gradlew build + - name: JaCoco Test Report + run: ./gradlew jacocoTestReport + - uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./Library/build/reports/jacoco/test/jacocoTestReport.xml publish-release: diff --git a/README.md b/README.md index 66cc33e..567d805 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ [![Touch Portal Plugin SDK](https://raw.githubusercontent.com/ChristopheCVB/TouchPortalPluginSDK/master/resources/TP%20Plugin%20SDK%20Logo.png)](#touch-portal-plugin-sdk) -[![Build and Coverage](https://github.com/ChristopheCVB/TouchPortalPluginSDK/workflows/Build%20and%20Coverage/badge.svg)](#touch-portal-plugin-sdk) +[![Build, Coverage and Publish Release](https://github.com/ChristopheCVB/TouchPortalPluginSDK/workflows/Build,%20Coverage%20and%20Publish%20Release/badge.svg)](#touch-portal-plugin-sdk) +[![Build and Publish Snapshot](https://github.com/ChristopheCVB/TouchPortalPluginSDK/workflows/Build%20and%20Publish%20Snapshot/badge.svg)](#touch-portal-plugin-sdk) [![Code Coverage](https://codecov.io/gh/ChristopheCVB/TouchPortalPluginSDK/branch/master/graph/badge.svg)](https://codecov.io/gh/ChristopheCVB/TouchPortalPluginSDK) [![Language gradle: Java](https://img.shields.io/lgtm/grade/java/g/ChristopheCVB/TouchPortalPluginSDK.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/ChristopheCVB/TouchPortalPluginSDK/context:java)