CI #74
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 | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Gradle Wrapper Validation | |
uses: gradle/wrapper-validation-action@v1 | |
- name: Generate cache key | |
run: .github/scripts/checksum.sh checksum.txt | |
- uses: actions/cache@v2 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('checksum.txt') }} | |
restore-keys: | | |
${{ runner.os }}-gradle | |
- name: Install JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- name: Test Plugin | |
run: ./gradlew -p focus-gradle-plugin clean check --no-daemon --stacktrace | |
- name: (Fail-only) Bundle test reports | |
if: failure() | |
run: find . -type d -name 'reports' | zip -@ -r build-reports.zip | |
- name: (Fail-only) Upload the build report | |
if: failure() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: error-report | |
path: build-reports.zip | |
publish: | |
runs-on: ubuntu-latest | |
if: github.repository == 'dropbox/focus' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' | |
needs: [build] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- name: Upload Snapshot | |
run: ./gradlew -p focus-gradle-plugin clean publish --no-daemon --no-parallel --no-configuration-cache --stacktrace | |
env: | |
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }} | |
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }} | |
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} | |
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} | |
- name: Retrieve Version | |
run: echo "VERSION_NAME=$(./gradlew -q -p focus-gradle-plugin printVersionName)" >> $GITHUB_ENV | |
- name: Publish release (main only) | |
run: ./gradlew -p focus-gradle-plugin closeAndReleaseRepository --no-daemon --no-parallel | |
if: success() && !endsWith(env.VERSION_NAME, '-SNAPSHOT') | |
env: | |
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }} | |
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }} |