From 259d4b35d1a765c4050e722939068f82fd9d3530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Gonz=C3=A1lez?= Date: Wed, 19 Oct 2022 10:38:47 +0200 Subject: [PATCH] GH Workflow to upload --- .github/workflows/publish.yaml | 56 ++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/publish.yaml diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..976fcc3 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,56 @@ +name: Publish Library +on: + workflow_dispatch: + inputs: + versionName: + description: 'Version Name' + required: true + +jobs: + publish: + name: Publish + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'adopt' + + - name: Build library + run: ./gradlew :gsd:assembleRelease + + - name: Unit Test + run: ./gradlew :gsd:testReleaseUnitTest + + - name: Publish + run: ./gradlew publishReleasePublicationToSonatypeRepository --max-workers 1 closeAndReleaseStagingRepository + env: + VERSION_NAME: ${{ github.event.inputs.versionName }} + GPG_KEY: ${{ secrets.GPG_KEY }} + GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} + GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }} + MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} + MAVEN_CENTRAL_STAGING_PROFILE_ID: ${{ secrets.MAVEN_CENTRAL_STAGING_PROFILE_ID }} + + - name: Create and push tag + run: | + git config --global user.email "dagonco.dev@gmail.com" + git config --global user.name "$GITHUB_ACTOR" + git tag -a $TAG -m "Release $TAG" + git push origin $TAG + env: + TAG: ${{ github.event.inputs.versionName }} + + - name: Create Release on GitHub + uses: ncipollo/release-action@v1 + with: + tag: ${{ github.event.inputs.versionName }} + name: ${{ github.event.inputs.versionName }} + generateReleaseNotes: true + token: ${{ secrets.GITHUB_TOKEN }}