Git config verification: avoid mutating local git config and throw exception instead #161
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: Nebula Build | |
on: | |
push: | |
branches: | |
- '*' | |
tags: | |
- v*.*.* | |
- v*.*.*-rc.* | |
pull_request: | |
jobs: | |
validation: | |
name: "Gradle Wrapper Validation" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: gradle/wrapper-validation-action@v1 | |
buildmultijdk: | |
if: (!startsWith(github.ref, 'refs/tags/v')) | |
needs: validation | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# test against latest update of some major Java version(s), as well as specific LTS version(s) | |
java: [ 8, 17, 21] | |
name: Gradle Build without Publish | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Setup git user | |
run: | | |
git config --global user.name "$(git --no-pager log --format=format:'%an' -n 1)" | |
git config --global user.email "$(git --no-pager log --format=format:'%ae' -n 1)" | |
- name: Set up JDK 8 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'zulu' | |
java-version: '8' | |
java-package: jdk | |
- name: Setup jdk | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'zulu' | |
java-version: ${{ matrix.java }} | |
java-package: jdk | |
- uses: actions/cache@v1 | |
id: gradle-cache | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/gradle/dependency-locks/*.lockfile') }} | |
restore-keys: | | |
- ${{ runner.os }}-gradle- | |
- uses: actions/cache@v1 | |
id: gradle-wrapper-cache | |
with: | |
path: ~/.gradle/wrapper | |
key: ${{ runner.os }}-gradlewrapper-${{ hashFiles('gradle/wrapper/*') }} | |
restore-keys: | | |
- ${{ runner.os }}-gradlewrapper- | |
- name: Gradle build | |
run: ./gradlew --info --stacktrace build | |
env: | |
JDK_VERSION_FOR_TESTS: ${{ matrix.java }} | |
validatepluginpublication: | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: validation | |
runs-on: ubuntu-latest | |
name: Gradle Plugin Publication Validation | |
env: | |
NETFLIX_OSS_SONATYPE_USERNAME: ${{ secrets.ORG_SONATYPE_USERNAME }} | |
NETFLIX_OSS_SONATYPE_PASSWORD: ${{ secrets.ORG_SONATYPE_PASSWORD }} | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Setup jdk 8 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 1.8 | |
- uses: actions/cache@v1 | |
id: gradle-cache | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/gradle/dependency-locks/*.lockfile') }} | |
restore-keys: | | |
- ${{ runner.os }}-gradle- | |
- uses: actions/cache@v1 | |
id: gradle-wrapper-cache | |
with: | |
path: ~/.gradle/wrapper | |
key: ${{ runner.os }}-gradlewrapper-${{ hashFiles('gradle/wrapper/*') }} | |
restore-keys: | | |
- ${{ runner.os }}-gradlewrapper- | |
- name: Verify plugin publication | |
if: | | |
startsWith(github.ref, 'refs/tags/v') && | |
(!contains(github.ref, '-rc.')) | |
run: ./gradlew --stacktrace -Dgradle.publish.key=${{ secrets.gradlePublishKey }} -Dgradle.publish.secret=${{ secrets.gradlePublishSecret }} -Prelease.useLastTag=true final publishPlugin --validate-only -x check -x signPluginMavenPublication | |
publish: | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: validatepluginpublication | |
runs-on: ubuntu-latest | |
name: Gradle Build and Publish | |
env: | |
NETFLIX_OSS_SONATYPE_USERNAME: ${{ secrets.ORG_SONATYPE_USERNAME }} | |
NETFLIX_OSS_SONATYPE_PASSWORD: ${{ secrets.ORG_SONATYPE_PASSWORD }} | |
NETFLIX_OSS_SIGNING_KEY: ${{ secrets.ORG_SIGNING_KEY }} | |
NETFLIX_OSS_SIGNING_PASSWORD: ${{ secrets.ORG_SIGNING_PASSWORD }} | |
NETFLIX_OSS_REPO_USERNAME: ${{ secrets.ORG_NETFLIXOSS_USERNAME }} | |
NETFLIX_OSS_REPO_PASSWORD: ${{ secrets.ORG_NETFLIXOSS_PASSWORD }} | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Setup git user | |
run: | | |
git config --global user.name "$(git --no-pager log --format=format:'%an' -n 1)" | |
git config --global user.email "$(git --no-pager log --format=format:'%ae' -n 1)" | |
- name: Setup jdk 8 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 1.8 | |
- uses: actions/cache@v1 | |
id: gradle-cache | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/gradle/dependency-locks/*.lockfile') }} | |
restore-keys: | | |
- ${{ runner.os }}-gradle- | |
- uses: actions/cache@v1 | |
id: gradle-wrapper-cache | |
with: | |
path: ~/.gradle/wrapper | |
key: ${{ runner.os }}-gradlewrapper-${{ hashFiles('gradle/wrapper/*') }} | |
restore-keys: | | |
- ${{ runner.os }}-gradlewrapper- | |
- name: Publish candidate | |
if: | | |
startsWith(github.ref, 'refs/tags/v') && | |
contains(github.ref, '-rc.') | |
run: ./gradlew --info --stacktrace -Prelease.useLastTag=true candidate | |
- name: Publish release | |
if: | | |
startsWith(github.ref, 'refs/tags/v') && | |
(!contains(github.ref, '-rc.')) | |
run: ./gradlew --info --stacktrace -Dgradle.publish.key=${{ secrets.gradlePublishKey }} -Dgradle.publish.secret=${{ secrets.gradlePublishSecret }} -Prelease.useLastTag=true final |