|
| 1 | +name: Publish |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + inputs: |
| 5 | + versionName: |
| 6 | + description: 'Version Name' |
| 7 | + required: true |
| 8 | + |
| 9 | +jobs: |
| 10 | + publish: |
| 11 | + name: Publish |
| 12 | + runs-on: ubuntu-latest |
| 13 | + |
| 14 | + steps: |
| 15 | + - name: Checkout repository |
| 16 | + uses: actions/checkout@v2 |
| 17 | + |
| 18 | + - name: Set up JDK 11 |
| 19 | + uses: actions/setup-java@v2 |
| 20 | + with: |
| 21 | + java-version: '11' |
| 22 | + distribution: 'adopt' |
| 23 | + |
| 24 | + - name: Grant Permission to Execute Gradle |
| 25 | + run: chmod +x gradlew |
| 26 | + |
| 27 | + - name: Build with Gradle |
| 28 | + uses: gradle/gradle-build-action@v2 |
| 29 | + with: |
| 30 | + arguments: build |
| 31 | + |
| 32 | + - name: Publish Library |
| 33 | + run: | |
| 34 | + echo "Publishing library🚀" |
| 35 | + ./gradlew publish --no-daemon --no-parallel |
| 36 | + echo "Published✅" |
| 37 | +
|
| 38 | + echo "Releasing repository...🚀" |
| 39 | + ./gradlew closeAndReleaseRepository |
| 40 | + echo "Released✅" |
| 41 | + env: |
| 42 | + ORG_GRADLE_PROJECT_VERSION_NAME: ${{ github.event.inputs.versionName }} |
| 43 | + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY }} |
| 44 | + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_PASSWORD }} |
| 45 | + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }} |
| 46 | + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} |
| 47 | + |
| 48 | + - name: Create and push tag |
| 49 | + run: | |
| 50 | + git config --global user.email "shreyaspatilg@gmail.com" |
| 51 | + git config --global user.name "$GITHUB_ACTOR" |
| 52 | +
|
| 53 | + git tag -a $TAG -m "Release v$TAG" |
| 54 | + git push origin $TAG |
| 55 | + env: |
| 56 | + TAG: ${{ github.event.inputs.versionName }} |
| 57 | + |
| 58 | + - name: Create Release on GitHub |
| 59 | + id: create_release |
| 60 | + uses: actions/create-release@v1 |
| 61 | + env: |
| 62 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 63 | + with: |
| 64 | + tag_name: ${{ github.event.inputs.versionName }} |
| 65 | + release_name: MyLib ${{ github.event.inputs.versionName }} |
| 66 | + draft: true |
| 67 | + prerelease: false |
0 commit comments