Merge pull request #8 from sktston/feature/update-1.1.0 #4
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: Python CI with Docker (NCLOUD) | |
on: | |
push: | |
branches: | |
- develop | |
workflow_dispatch: | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
NCR_REGISTRY_PUBLIC: dev-did.ncr.fin-ntruss.com | |
NCR_REGISTRY_PRIVATE: r5p79moi.private-ncr.fin-ntruss.com | |
NCR_REPOSITORY: ston/tails | |
IMAGE_TAG: ${{ github.sha }} | |
DOCKERFILE_PATH: docker/Dockerfile.tails-server | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Slack message - start | |
uses: act10ns/slack@v1 | |
with: | |
status: starting | |
if: always() | |
- name: Checkout tails-server | |
uses: actions/checkout@v2 | |
- name: Login to NCP Container Registry | |
id: log-in-to-ncr | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ env.NCR_REGISTRY_PUBLIC }} | |
username: ${{ secrets.NCP_ACCESS_KEY_ID }} | |
password: ${{ secrets.NCP_SECRET_KEY }} | |
- name: Build, tag, and push image to NCP Container registry | |
id: build-and-push-to-ncr | |
run: | | |
docker build -f $DOCKERFILE_PATH -t $NCR_REGISTRY_PUBLIC/$NCR_REPOSITORY:$IMAGE_TAG . | |
docker push $NCR_REGISTRY_PUBLIC/$NCR_REPOSITORY:$IMAGE_TAG | |
- name: Slack messsae - end | |
uses: act10ns/slack@v1 | |
with: | |
status: ${{ job.status }} | |
steps: ${{ toJson(steps) }} | |
if: always() | |
update-configuration: | |
needs: build-and-push-image | |
runs-on: ubuntu-20.04 | |
concurrency: kustomize | |
steps: | |
- name: Slack message - start | |
uses: act10ns/slack@v1 | |
with: | |
status: starting | |
if: always() | |
- name: Checkout ston-config | |
uses: actions/checkout@v2 | |
with: | |
repository: sktston/ston-config | |
token: ${{ secrets.PAT }} | |
- name: Setup Kustomize | |
id: setup-kustomize | |
uses: imranismail/setup-kustomize@v1 | |
with: | |
kustomize-version: "3.9.2" | |
- name: Update the image tag with Kustomize | |
id: update-config-with-kustomize | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git pull origin develop | |
cd overlays/${GITHUB_REF##*/} | |
kustomize edit set image $NCR_REGISTRY_PRIVATE/$NCR_REPOSITORY:$IMAGE_TAG | |
git add kustomization.yaml | |
git commit -m "Deploying image $NCR_REGISTRY_PRIVATE/$NCR_REPOSITORY:$IMAGE_TAG" | |
git push origin develop | |
- name: Slack messsae - end | |
uses: act10ns/slack@v1 | |
with: | |
status: ${{ job.status }} | |
steps: ${{ toJson(steps) }} | |
if: always() |