Feat: add branch argument support #83
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: Java CI | |
on: | |
push: | |
paths: | |
- '**.gradle' | |
- '**.properties' | |
- '**/src/**' | |
- '.github/workflows/**' | |
branches: | |
- 'master' | |
pull_request: | |
paths: | |
- '**.gradle' | |
- '**.properties' | |
- '**/src/**' | |
- '.github/workflows/**' | |
types: [opened, synchronize, reopened] | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'push' }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Install EdgeDB | |
uses: edgedb/setup-edgedb@8bc9e10005674ec772652b86e1fdd476e6462284 | |
with: | |
server-version: 'stable' | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
- name: Build with Gradle | |
run: ./gradlew build --info | |
release: | |
name: Publish artifacts | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name != 'pull_request' && ( (vars.runReleaseOnPush || 'true') == 'true' || contains(github.event.head_commit.message, '[release]') ) }} | |
needs: build | |
env: | |
HAS_CREDENTIALS: ${{ secrets.signingKey != '' && secrets.signingPassword != '' && secrets.sonatypeUsername != '' && secrets.sonatypePassword != '' }} | |
steps: | |
- name: Validate repository secrets for publish | |
if: ${{ env.HAS_CREDENTIALS != 'true' }} | |
run: | | |
echo '### Release Failed ❌' >> $GITHUB_STEP_SUMMARY | |
echo 'This repository does not have all required secrets: signingKey, signingPassword, sonatypeUsername or sonatypePassword).' >> $GITHUB_STEP_SUMMARY | |
echo "::error::This repository does not have all required secrets: signingKey, signingPassword, sonatypeUsername or sonatypePassword)." | |
exit -1 | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
- name: Publish with Gradle | |
run: ./gradlew -x test publish | |
env: | |
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.signingKey }} | |
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.signingPassword }} | |
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.sonatypeUsername }} | |
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.sonatypePassword }} |