1.2.1 into master #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and publish | |
on: | |
pull_request: | |
branches: | |
- master | |
types: | |
- closed | |
env: | |
SIGNING_KEY: ${{ secrets.SIGNING_KEY }} | |
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} | |
MAVEN_URL: ${{ secrets.MAVEN_URL }} | |
MAVEN_LOGIN: ${{ secrets.MAVEN_LOGIN }} | |
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} | |
STAGING_MAVEN_URL: ${{ secrets.STAGING_MAVEN_URL }} | |
STAGING_MAVEN_LOGIN: ${{ secrets.STAGING_MAVEN_LOGIN }} | |
STAGING_MAVEN_PASSWORD: ${{ secrets.STAGING_MAVEN_PASSWORD }} | |
jobs: | |
build_and_publish: | |
if: github.event.pull_request.merged && (startsWith(github.event.pull_request.head.ref, 'release/') || startsWith(github.event.pull_request.head.ref, 'hotfix/')) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Extract version from branch name (for release branches) | |
if: startsWith(github.event.pull_request.head.ref, 'release/') | |
run: | | |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}" | |
VERSION=${BRANCH_NAME#release/} | |
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Extract version from branch name (for hotfix branches) | |
if: startsWith(github.event.pull_request.head.ref, 'hotfix/') | |
run: | | |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}" | |
VERSION=${BRANCH_NAME#hotfix/} | |
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Checkout source | |
uses: actions/checkout@v2 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'corretto' | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2.9.0 | |
- name: Gradle clean | |
run: ./gradlew clean | |
- name: Gradle generate documentation | |
run: ./gradlew sdk:generateDocumentation | |
- name: Gradle prepare sources | |
run: ./gradlew sdk:sourcesJar | |
- name: Gradle build | |
run: ./gradlew sdk:assembleRelease | |
- name: Publish to Maven Central | |
run: ./gradlew sdk:publishReleasePublicationToMavenCentralRepository | |
- name: Publish to local maven | |
run: ./gradlew sdk:publishReleasePublicationToLocalRepository | |
- name: Zip local maven | |
run: | | |
zip -qq -r tpayMaven.zip tpayMaven | |
cd ../.. | |
mv ./sdk/build/tpayMaven.zip . | |
working-directory: ./sdk/build | |
- name: Create Github release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ env.RELEASE_VERSION }} | |
body: "Release is available on Maven Central repository. Add > implementation \"com.tpay:sdk:${{ env.RELEASE_VERSION }}\" < to your app level build.gradle file." | |
artifacts: "tpayMaven.zip" |