Prepare snapshot version 0.8.4-SNAPSHOT #175
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: CI | |
on: | |
push: | |
branches: [ main ] | |
paths-ignore: | |
- '**.md' | |
- 'LICENSE' | |
- 'NOTICE' | |
- '.gitignore' | |
pull_request: | |
branches: [ main ] | |
paths-ignore: | |
- '**.md' | |
- 'LICENSE' | |
- 'NOTICE' | |
- '.gitignore' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./server-sdk-kotlin | |
steps: | |
- name: checkout server-sdk-kotlin | |
uses: actions/checkout@v3 | |
with: | |
path: ./server-sdk-kotlin | |
submodules: recursive | |
- name: set up JDK 12 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '12' | |
distribution: 'adopt' | |
- uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Gradle clean | |
run: ./gradlew clean | |
- name: Spotless check | |
if: github.event_name == 'pull_request' | |
run: | | |
git fetch origin main --depth 1 | |
./gradlew spotlessCheck | |
- name: Build with Gradle | |
run: ./gradlew assemble | |
- name: get version name | |
if: github.event_name == 'push' | |
run: echo "::set-output name=version_name::$(cat gradle.properties | grep VERSION_NAME | cut -d "=" -f2)" | |
id: version_name | |
- name: Create gpg key and import into gradle properties | |
if: github.event_name == 'push' && contains(steps.version_name.outputs.version_name,'SNAPSHOT') | |
run: | | |
echo $GPG_KEY_ARMOR | base64 --decode > ./release.asc | |
gpg --quiet --output $GITHUB_WORKSPACE/release.gpg --dearmor ./release.asc | |
sed -i -e "s,nexusUsername=,nexusUsername=$NEXUS_USERNAME,g" gradle.properties | |
sed -i -e "s,nexusPassword=,nexusPassword=$NEXUS_PASSWORD,g" gradle.properties | |
sed -i -e "s,signing.keyId=,signing.keyId=$GPG_KEY_ID,g" gradle.properties | |
sed -i -e "s,signing.password=,signing.password=$GPG_PASSWORD,g" gradle.properties | |
sed -i -e "s,signing.secretKeyRingFile=,signing.secretKeyRingFile=$GITHUB_WORKSPACE/release.gpg,g" gradle.properties | |
env: | |
GPG_KEY_ARMOR: "${{ secrets.SIGNING_KEY_ARMOR }}" | |
GPG_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} | |
GPG_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} | |
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} | |
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} | |
- name: Publish snapshot | |
if: github.event_name == 'push' && contains(steps.version_name.outputs.version_name,'SNAPSHOT') | |
run: ./gradlew publish |