Skip to content

Merge branch 'main' into develop #217

Merge branch 'main' into develop

Merge branch 'main' into develop #217

Workflow file for this run

name: Docker Dev CI
on:
push:
branches: [ "develop" ]
# pull_request:
# branches: [ "develop" ]
env:
# Use docker.io for Docker Hub if empty
REGISTRY: docker.io
# github.repository as <account>/<repo>
IMAGE_NAME: shonn/art-be
DOCKER_REGISTRY_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKER_REGISTRY_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
JASYPT_ENCRYPTOR_PASSWORD: ${{ secrets.JASYPT_ENCRYPTOR_PASSWORD }}
jobs:
build-dockerized-development:
name: Build Dockerized Development
runs-on: ubuntu-latest
services:
redis:
image: redis
ports:
- 16379:6379
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
- name: Build with Gradle
uses: gradle/gradle-build-action@v2.4.2
with:
arguments: |
build
# -Pprofile=prod
# -Dspring.profiles.active=prod
- name: Setup Docker buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
- name: Build the Docker image
run: docker build --tag ${{ env.IMAGE_NAME }}:${{ secrets.MAJOR }}.${{ secrets.MINOR }}.dev -f Dockerfile.dev .
- name: Login to registry ${{ env.REGISTRY }}
run: echo "$DOCKER_REGISTRY_PASSWORD" | docker login "$REGISTRY" -u "$DOCKER_REGISTRY_USERNAME" --password-stdin
- name: Push to ${{ env.REGISTRY }}
run: docker push ${{ env.IMAGE_NAME }}:${{ secrets.MAJOR }}.${{ secrets.MINOR }}.dev
- name: Autoincrement a new minor version
run: |
echo "NEW_MINOR_VERSION=$((${{ secrets.MINOR }}+1))" >> $GITHUB_ENV
- name: Update Minor version
uses: hmanzur/actions-set-secret@v2.0.0
with:
name: 'MINOR'
value: ${{ env.NEW_MINOR_VERSION }}
repository: ${{ secrets.REPO }}
token: ${{ secrets.REPO_ACCESS_TOKEN }}
kubernetes-resource-update:
name: Kubernetes resource update
runs-on: ubuntu-latest
needs: build-dockerized-development
steps:
- name: Setup Kustomize
uses: imranismail/setup-kustomize@v1
- name: Checkout kustomize repo
uses: actions/checkout@v2
with:
repository: inje-megabrain/megabrain-infra-apps
ref: apps/art-be
token: ${{ secrets.REPO_ACCESS_TOKEN }}
- name: Update Kubernetes resource
run: |
cd apps/art-be/overlays/dev
kustomize edit set image ${{ env.IMAGE_NAME }}:${{ secrets.MAJOR }}.${{ secrets.MINOR }}.dev
cat kustomization.yaml
- name: Commit and push changes
run: |
cd apps/art-be
git config --global user.name "Hoon9901"
git config --global user.email "shonn.dev@gmail.com"
git commit -am "Update k8s image"
git push -u origin apps/art-be