|
| 1 | +name: Publish Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + |
| 8 | +jobs: |
| 9 | + check: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v1 |
| 14 | + - name: Cache gradle dependencies |
| 15 | + uses: actions/cache@v1 |
| 16 | + with: |
| 17 | + path: ~/.gradle |
| 18 | + key: ${{ runner.os }}-gradle${{ hashFiles('gradle/wrapper/gradle-wrapper.properties')}}-${{ hashFiles('gradle.properties')}} |
| 19 | + restore-keys: | |
| 20 | + ${{ runner.os }}-gradle${{ hashFiles('gradle/wrapper/gradle-wrapper.properties')}}- |
| 21 | + ${{ runner.os }}- |
| 22 | + - name: set up JDK 1.8 |
| 23 | + uses: actions/setup-java@v1 |
| 24 | + with: |
| 25 | + java-version: 1.8 |
| 26 | + |
| 27 | + - name: Run tests with Gradle |
| 28 | + run: ./gradlew testDebug --no-daemon |
| 29 | + - name: Archive test results |
| 30 | + uses: actions/upload-artifact@v1 |
| 31 | + if: always() |
| 32 | + with: |
| 33 | + name: test-results |
| 34 | + path: "yoti-sdk/build/reports/tests/" |
| 35 | + |
| 36 | + - name: Build sample-1 |
| 37 | + run: ./gradlew sample-app:assembleDebug --no-daemon |
| 38 | + - name: Upload sample-1 |
| 39 | + uses: actions/upload-artifact@v1 |
| 40 | + with: |
| 41 | + name: sample-1 |
| 42 | + path: "sample-app/build/outputs/apk/" |
| 43 | + |
| 44 | + - name: Build sample-2 |
| 45 | + run: ./gradlew sample-app-2:assembleDebug --no-daemon |
| 46 | + - name: Upload sample-2 |
| 47 | + uses: actions/upload-artifact@v1 |
| 48 | + with: |
| 49 | + name: sample-2 |
| 50 | + path: "sample-app-2/build/outputs/apk/" |
| 51 | + |
| 52 | + deploy: |
| 53 | + runs-on: ubuntu-latest |
| 54 | + needs: check |
| 55 | + |
| 56 | + steps: |
| 57 | + - uses: actions/checkout@v1 |
| 58 | + - name: Cache gradle dependencies |
| 59 | + uses: actions/cache@v1 |
| 60 | + with: |
| 61 | + path: ~/.gradle |
| 62 | + key: ${{ runner.os }}-gradle${{ hashFiles('gradle/wrapper/gradle-wrapper.properties')}}-${{ hashFiles('gradle.properties')}} |
| 63 | + restore-keys: | |
| 64 | + ${{ runner.os }}-gradle${{ hashFiles('gradle/wrapper/gradle-wrapper.properties')}}- |
| 65 | + ${{ runner.os }}- |
| 66 | + - name: set up JDK 1.8 |
| 67 | + uses: actions/setup-java@v1 |
| 68 | + with: |
| 69 | + java-version: 1.8 |
| 70 | + |
| 71 | + - name: Publish to maven |
| 72 | + env: |
| 73 | + sonatypeUsername: ${{ secrets.sonatypeUsername }} |
| 74 | + sonatypePassword: ${{ secrets.sonatypePassword }} |
| 75 | + signingKey: ${{ secrets.signingPrivateKey }} |
| 76 | + signingPassword: ${{ secrets.signingPrivateKeyPassword }} |
| 77 | + run: ./gradlew publishAarReleasePublicationToMavenCentralRepository closeAndReleaseRepository "-PsonatypeUsername=$sonatypeUsername" "-PsonatypePassword=$sonatypePassword" "-PinMemorySigningKey=$signingKey" "-PinMemoryKeyPassword=$signingPassword" --no-daemon |
| 78 | + |
| 79 | + tag: |
| 80 | + runs-on: ubuntu-latest |
| 81 | + needs: deploy |
| 82 | + |
| 83 | + steps: |
| 84 | + - uses: actions/checkout@v1 |
| 85 | + - name: Add tag |
| 86 | + run: | |
| 87 | + CURRENT_VERSION=`cat gradle.properties | grep "pomVersion\s*=" | sed "s/pomVersion\s*=//"` |
| 88 | + git config --local user.email "[email protected]" |
| 89 | + git config --local user.name "GitHub Action" |
| 90 | + git tag -a v$CURRENT_VERSION -m "Version $CURRENT_VERSION deployed by Github Actions" |
| 91 | + - name: Push tag |
| 92 | + uses: ad-m/github-push-action@master |
| 93 | + with: |
| 94 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 95 | + tags: true |
| 96 | + |
0 commit comments