Skip to content

Commit

Permalink
feature. updata action for ft service
Browse files Browse the repository at this point in the history
  • Loading branch information
ktkfree committed Nov 21, 2022
1 parent 31a4a15 commit 0e62386
Showing 1 changed file with 46 additions and 38 deletions.
84 changes: 46 additions & 38 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,57 @@ on:
push:
branches:
- main
- 'release**'
- "release**"
- ft
env:
SERVICE: tks-contract
TARGET: cicd
TAG: ${{github.sha}}

jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{secrets.DOCKERHUB_USERNAME}}
password: ${{secrets.DOCKERHUB_TOKEN}}

- name: Build and Push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: |
sktcloud/${{env.SERVICE}}:${{env.TAG}}
- name: Setup Kustomize
uses: imranismail/setup-kustomize@v1
with:
kustomize-version: "3.6.1"
- run: |
git config --global user.email "[email protected]"
git config --global user.name "tks"
git clone "https://${{secrets.BOT_GITHUB_TOKEN}}@github.com/openinfradev/cicd-manifests.git"
cd cicd-manifests/${SERVICE}/overlay/${TARGET}
kustomize edit set image docker.io/sktcloud/${SERVICE}:${TAG}
git add kustomization.yaml
git commit --allow-empty -m "Set image tag to ${SERVICE} ${TAG}"
git pull --rebase origin main
git push origin main --force
- name: Checkout
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{secrets.DOCKERHUB_USERNAME}}
password: ${{secrets.DOCKERHUB_TOKEN}}

- name: Build and Push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: |
sktcloud/${{env.SERVICE}}:${{env.TAG}}
- name: Setup Kustomize
uses: imranismail/setup-kustomize@v1
with:
kustomize-version: "3.6.1"
- run: |
git config --global user.email "[email protected]"
git config --global user.name "tks"
git clone "https://${{secrets.BOT_GITHUB_TOKEN}}@github.com/openinfradev/cicd-manifests.git"
TARGET='cicd'
if [[ ${{github.ref}} == *"develop"* ]]; then
TARGET='development'
elif [[ ${{github.ref}} == *"ft"* ]]; then
TARGET='ft'
fi
cd cicd-manifests/${SERVICE}/overlay/${TARGET}
kustomize edit set image docker.io/sktcloud/${SERVICE}:${TAG}
git add kustomization.yaml
git commit --allow-empty -m "Set image tag to ${SERVICE} ${TAG}"
git pull --rebase origin main
git push origin main --force

0 comments on commit 0e62386

Please sign in to comment.