Publish #99
This file contains hidden or 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: Publish | |
| on: | |
| workflow_dispatch: | |
| 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: Grant Permission to Execute Gradle | |
| run: chmod +x gradlew | |
| - name: Build with Gradle | |
| uses: gradle/gradle-build-action@v2 | |
| with: | |
| arguments: build | |
| - name: Publish Library | |
| run: | | |
| ./gradlew publishToMavenCentral | |
| ./gradlew releaseRepository | |
| env: | |
| ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_PASSWORD }} | |
| ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_TOKEN_CENTRAL_REPOSITORY_USERNAME }} | |
| ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_TOKEN_CENTRAL_REPOSITORY_PASSWORD }} | |
| - id: get_version | |
| name: Retrieve version | |
| run: echo "::set-output name=VERSION::$(./gradlew printVersionName | grep version | cut -f 2 -d =)" | |
| - name: Update version on ReadMe | |
| run: | | |
| sed -i 's:<version>.*</version>:<version>${{ steps.get_version.outputs.VERSION }}</version>:g' README.md | |
| sed -i "s;version: '.*';version: '${{ steps.get_version.outputs.VERSION }}';g" README.md | |
| - name: Commit and push the new version | |
| run: | | |
| git config --global user.name "github-actions" | |
| git config --global user.email "github-actions@users.noreply.github.com" | |
| git commit -a -m "[githubAction] increment Patch Version to ${{ steps.get_version.outputs.VERSION }} in README.md" | |
| git push | |
| - name: Create and push tag | |
| run: | | |
| git config --global user.email "jpinet@hopper.com" | |
| git config --global user.name "$GITHUB_ACTOR" | |
| git tag -a ${{ steps.get_version.outputs.VERSION }} -m "Release v${{ steps.get_version.outputs.VERSION }}" | |
| git push origin ${{ steps.get_version.outputs.VERSION }} | |
| env: | |
| TAG: ${{ github.event.inputs.versionName }} | |
| - name: Create Release on GitHub | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ steps.get_version.outputs.VERSION }} | |
| release_name: v${{ steps.get_version.outputs.VERSION }} | |
| draft: true | |
| prerelease: false |