Skip to content

#70 image가 배포되면 helm chart로 pr 날리도록 변경 #78

#70 image가 배포되면 helm chart로 pr 날리도록 변경

#70 image가 배포되면 helm chart로 pr 날리도록 변경 #78

Workflow file for this run

name: Build
on:
push:
branches:
- '*'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Cache SonarQube packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Gradle packages
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Docker Login
run: echo "${{ secrets.TOKEN }}" | docker login ghcr.io -u ${{ secrets.USERNAME }} --password-stdin
- name: Build with Gradle
env:
USERNAME: ${{secrets.USERNAME}}
TOKEN: ${{secrets.TOKEN}}
GITHUB_TOKEN: ${{ secrets.TOKEN }} # Needed to get PR information, if any
run: ./gradlew clean test jacocoTestReport --stacktrace --profile
- name: SonarQube Scan
uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
- 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 Jib
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 :api:jib
- name: Checkout tools repo
uses: actions/checkout@v3
with:
repository: ssu-commerce/helm-charts
path: chart/ssu-commerce
fetch-depth: 0
- name: Update Image Version in the related HelmChart values.yaml
uses: fjogeleit/yaml-update-action@main
with:
valueFile: 'chart/ssu-commerce/values.yaml'
propertyPath: 'book.image.tag'
value: "${{ steps.current-time.outputs.formattedTime }}.${{github.run_number}}"
repository: ssu-commerce/helm-charts
branch: deployment/${{ steps.current-time.outputs.formattedTime }}.${{github.run_number}}
targetBranch: main
createPR: true
message: 'Update Image Version to "${{ steps.current-time.outputs.formattedTime }}.${{github.run_number}}"'
token: ${{ secrets.TOKEN }}
workDir: helm-charts
# - name: Push helm repo
# run: |
# git config --global user.email "[email protected]"
# git config --global user.name "chohanjoo"
#
# git add values.yaml;
# git commit --message "Update book-server image tag to ${{ steps.current-time.outputs.formattedTime }}.${{github.run_number}}";
# git config -l | grep 'http\..*\.extraheader' | cut -d= -f1 | xargs -L1 git config --unset-all
# git push