Test #131
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: cd for transfer-service | |
on: | |
pull_request: | |
branches: [ main ] | |
paths: | |
- transfer-service/** | |
- .github/workflows/transfer-service-cd.yml | |
env: | |
PROJECT_ID: ${{ secrets.PROJECT_ID }} | |
DOCKER_REPO: ${{ secrets.DOCKER_REPO }} | |
REGION: ${{ secrets.REGION }} | |
WORKSTATION_IMAGE: transfer-service | |
VERSION: '1.1.0' | |
IMAGE: ${{ secrets.REGION }}-docker.pkg.dev/${{ secrets.PROJECT_ID }}/${{ secrets.DOCKER_REPO }}/transfer-service | |
REDIS_HOST: ${{secrets.REDIS_HOST}} | |
REDIS_PORT: ${{secrets.REDIS_PORT}} | |
DATASOURCE_URL: ${{secrets.DB_URL}} | |
DATASOURCE_USERNAME: ${{secrets.DB_USERNAME}} | |
DATASOURCE_PASSWORD: ${{secrets.DB_PASSWORD}} | |
SLACK_WEBHOOK_URL: ${{secrets.SLACK_WEBHOOK_URL}} | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out Repository | |
uses: actions/checkout@v3 | |
- name: Cache Gradle caches | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ github.job}}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: ${{ runner.os }}-gradle-${{ github.job }} | |
- name: Cache Jib layers | |
uses: actions/cache@v3 | |
with: | |
path: ./transfer-service/build/jib-cache | |
key: ${{ runner.os }}-jib-${{ github.job }}-${{ hashFiles('**/build.gradle') }} | |
restore-keys: ${{ runner.os }}-jib-${{ github.job }} | |
- name: Set up google auth | |
id: 'auth' | |
uses: google-github-actions/auth@v1 | |
with: | |
credentials_json: ${{ secrets.GCE_SA_KEY }} | |
- id: 'get-credentials' | |
uses: google-github-actions/get-gke-credentials@v1 | |
with: | |
cluster_name: cluster-1 | |
location: ${{ env.REGION }}-c | |
- name: Docker auth | |
run: |- | |
gcloud auth configure-docker ${{ env.REGION }}-docker.pkg.dev --quiet | |
- name: set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Docker Build | |
run: ./gradlew :transfer-service:jib | |
- name: Deploy | |
run: | | |
sed "s,\${image},${{ env.IMAGE }},g" ./transfer-service/resources.yaml > cronJob.yaml | |
kubectl apply -f ./cronJob.yaml | |