add explicitly reference. #34
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
on: | |
push: | |
branches: | |
- main | |
- master | |
- 'release/**' | |
pull_request: | |
branches: | |
- main | |
- master | |
- 'release/**' | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Set environment | |
run: echo "VERSION=${GITHUB_REF/refs\/heads\/release\//}.$GITHUB_RUN_NUMBER" >> $GITHUB_ENV | |
- name: Display environment information | |
run: | | |
echo Building version: ${{ env.VERSION }} | |
- uses: actions/checkout@v2 | |
- name: Set up development environment | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 17 | |
- name: Install packages | |
run: gradle wrapper | |
- name: Validate Gradle wrapper | |
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b | |
- name: Run build and test | |
run: ./gradlew build --info | |
- name: Create Github Release and Tag | |
if: github.ref != 'refs/heads/main' && github.ref != 'refs/heads/master' && github.event_name == 'push' | |
run: | | |
git tag ${GITHUB_REF/refs\/heads\/release\//}.$GITHUB_RUN_NUMBER | |
git push origin ${GITHUB_REF/refs\/heads\/release\//}.$GITHUB_RUN_NUMBER | |
- name: Publish SDK | |
if: github.ref != 'refs/heads/main' && github.ref != 'refs/heads/master' && github.event_name == 'push' | |
run: gradle publish | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
MAVEN_OSSRH_TOKEN: ${{ secrets.MAVEN_OSSRH_TOKEN }} |