From 1ab0c7b493616fdee59d04ccf30f32a7cf72bab9 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Wed, 31 May 2023 15:22:21 -0700 Subject: [PATCH] Add a Github Action to publish SNAPSHOTS after every commit. Summary: I'm adding this action which will setup publishing of `-SNAPSHOT` version after every commit to main. Reviewed By: mdvacca Differential Revision: D46330012 fbshipit-source-id: 8d9f32a357f157a8f2e05c88074befd8dd871c94 --- .github/actions/setup-android/action.yml | 4 ++- ...ndroid.yml => publish-android-release.yml} | 2 +- .github/workflows/publish-android-snashot.yml | 36 +++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) rename .github/workflows/{publish-android.yml => publish-android-release.yml} (96%) create mode 100644 .github/workflows/publish-android-snashot.yml diff --git a/.github/actions/setup-android/action.yml b/.github/actions/setup-android/action.yml index f138d87daa..67ea26b996 100644 --- a/.github/actions/setup-android/action.yml +++ b/.github/actions/setup-android/action.yml @@ -1,4 +1,4 @@ -name: Setup Android envirionment +name: Setup Android environment runs: using: "composite" @@ -8,3 +8,5 @@ runs: with: distribution: zulu java-version: 17 + - name: Configure Gradle Caches + uses: gradle/gradle-build-action@v2 diff --git a/.github/workflows/publish-android.yml b/.github/workflows/publish-android-release.yml similarity index 96% rename from .github/workflows/publish-android.yml rename to .github/workflows/publish-android-release.yml index 16f6d4e44b..05aee86462 100644 --- a/.github/workflows/publish-android.yml +++ b/.github/workflows/publish-android-release.yml @@ -1,4 +1,4 @@ -name: Android +name: Publish Android Release on: release: diff --git a/.github/workflows/publish-android-snashot.yml b/.github/workflows/publish-android-snashot.yml new file mode 100644 index 0000000000..ed90e3cc57 --- /dev/null +++ b/.github/workflows/publish-android-snashot.yml @@ -0,0 +1,36 @@ +name: Publish Android Snapshot + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + publish: + name: Publish Snapshot + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Setup + uses: ./.github/actions/setup-android + + - name: Publish to Maven Local + run: ./gradlew publishToMavenLocal + env: + ORG_GRADLE_PROJECT_USE_SNAPSHOT: true + + - name: Upload Build Artifacts + uses: actions/upload-artifact@v3 + with: + name: 'snapshot-artifacts' + path: '~/.m2/repository/' + + - name: Publish to the Snapshot Repository + run: ./gradlew publishToSonatype + env: + ORG_GRADLE_PROJECT_NEXUS_USERNAME: ${{ secrets.ORG_GRADLE_PROJECT_NEXUS_USERNAME }} + ORG_GRADLE_PROJECT_NEXUS_PASSWORD: ${{ secrets.ORG_GRADLE_PROJECT_NEXUS_PASSWORD }} + ORG_GRADLE_PROJECT_USE_SNAPSHOT: true