update ci script #35
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: Release | |
on: | |
push: | |
tags: | |
- '*.*.*' | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
environment: deployment | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get tag | |
id: vars | |
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} | |
- name: Verify tag | |
run: | | |
VERSION=$(grep VERSION_NAME gradle.properties | awk -F= '{ print $2 }' | sed "s/-SNAPSHOT//") | |
if [ "${{ steps.vars.outputs.tag }}" != "$VERSION" ]; then { | |
echo "Tag ${{ steps.vars.outputs.tag }} does not match the package version ($VERSION)" | |
exit 1 | |
} fi | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: cache gradle dependencies | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-core-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle-core- | |
- name: Publush release to sonatype | |
run: ./gradlew clean build publish publishToSonatype -Prelease closeAndReleaseSonatypeStagingRepository | |
env: | |
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} | |
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} | |
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.NEXUS_USERNAME }} | |
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.NEXUS_PASSWORD }} | |
SIGNING_PRIVATE_KEY_BASE64: ${{ secrets.SIGNING_PRIVATE_KEY_BASE64 }} | |
- name: create release | |
run: | | |
curl \ | |
-X POST \ | |
-H "Authorization: token $RELEASE_TOKEN" \ | |
https://api.github.com/repos/${{github.repository}}/releases \ | |
-d '{"tag_name": "${{ env.RELEASE_VERSION }}", "name": "${{ env.RELEASE_VERSION }}", "body": "Release of version ${{ env.RELEASE_VERSION }}", "draft": false, "prerelease": false, "generate_release_notes": true}' | |
env: | |
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
RELEASE_VERSION: ${{ steps.vars.outputs.tag }} |