General code improvements and cleanup (#513) #393
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: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
jdk: | |
- 17 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
**/build-cache | |
!tmp | |
key: v2-${{ runner.os }}-${{ matrix.jdk }}-gradle-${{ hashFiles('**/*.gradle*') }} | |
restore-keys: | | |
v2-${{ runner.os }}-${{ matrix.jdk }}-gradle- | |
- name: Import snapshot GPG key | |
run: | | |
echo "$GPG_SIGNING_KEY_PW" | gpg --batch --import --yes --passphrase-fd 0 <(echo -n "$GPG_SIGNING_KEY" | base64 --decode) | |
mkdir -p ~/.gradle | |
echo -n "signing.gnupg.passphrase=${GPG_SIGNING_KEY_PW}" >> ~/.gradle/gradle.properties | |
env: | |
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} | |
GPG_SIGNING_KEY_PW: ${{ secrets.GPG_SIGNING_KEY_PW }} | |
if: >- | |
github.repository == 'KeepSafe/dexcount-gradle-plugin' && github.ref == 'refs/heads/master' | |
- name: Import random GPG key | |
run: | | |
gpg --batch --gen-key <(cat <<EOF | |
Key-Type: 1 | |
Key-Length: 2048 | |
Key-Usage: sign | |
Passphrase: foobar | |
Name-Real: Dexcount Developers | |
Name-Email: foo@bar.com | |
Expire-Date: seconds=1200 | |
%commit | |
EOF | |
) | |
mkdir -p ~/.gradle | |
echo -n "signing.gnupg.passphrase=foobar" >> ~/.gradle/gradle.properties | |
if: >- | |
github.repository != 'KeepSafe/dexcount-gradle-plugin' || | |
github.ref != 'refs/heads/master' | |
- name: Set up JDK ${{ matrix.jdk }} | |
uses: actions/setup-java@v1 | |
with: | |
java-version: ${{ matrix.jdk }} | |
- name: Build and test | |
uses: eskatos/gradle-command-action@v1 | |
with: | |
arguments: check | |
- name: Deploy snapshot | |
uses: eskatos/gradle-command-action@v1 | |
with: | |
arguments: uploadSnapshot | |
if: >- | |
github.event_name == 'push' && | |
github.repository == 'KeepSafe/dexcount-gradle-plugin' && | |
github.ref == 'refs/heads/master' | |
env: | |
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | |
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} |