Merge pull request #77 from ssu-commerce/feature/#67-grpc-book-rental #11
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: Build | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
check-changes: | |
runs-on: ubuntu-latest | |
outputs: | |
grpc_changed: ${{ steps.filter_grpc.outputs.grpc_changed }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- id: filter_grpc | |
run: | | |
GRPC_CHANGED=$(git diff --name-only HEAD^ HEAD | grep -q 'grpc/' && echo true || echo false) | |
echo "grpc_changed=$GRPC_CHANGED" >> $GITHUB_OUTPUT | |
trigger-grpc-deploy: | |
if: ${{ needs.check-changes.outputs.grpc_changed == 'true' }} | |
needs: check-changes | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Cache Gradle packages | |
uses: actions/cache@v1 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | |
restore-keys: ${{ runner.os }}-gradle | |
- name: Set Current Time | |
uses: 1466587594/get-current-time@v1 | |
id: current-time | |
with: | |
format: YYYY.MM | |
utcOffset: "+09:00" | |
if: always() | |
- name: Build with Gradle and Publish Grpc | |
env: | |
VERSION: "${{ steps.current-time.outputs.formattedTime }}.${{github.run_number}}" | |
USERNAME: ${{secrets.USERNAME}} | |
TOKEN: ${{secrets.TOKEN}} | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} # Needed to get PR information, if any | |
run: ./gradlew :grpc:publish |