add cni & csi #34
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: Docker Image CI/CD | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
environment: production | |
steps: | |
- name: Checkout 'study' repository | |
uses: actions/checkout@v3 | |
- name: Login to Docker Registry | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
registry: art.montkim.com | |
- name: Extract short SHA | |
id: vars | |
run: echo "SHORT_SHA=${GITHUB_SHA::6}" >> $GITHUB_ENV | |
- name: Build and push Docker image | |
id: build-push | |
run: | | |
docker build -t "art.montkim.com/study/my-gitbook:${{ env.SHORT_SHA }}" . | |
docker push "art.montkim.com/study/my-gitbook:${{ env.SHORT_SHA }}" | |
- name: Checkout 'study-manifests' repository | |
if: success() # 이전 단계가 성공한 경우에만 실행 | |
uses: actions/checkout@v3 | |
with: | |
repository: idoyo7/study-manifests | |
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }} | |
path: study-manifests | |
- name: Update manifest files | |
if: success() # 이전 단계가 성공한 경우에만 실행 | |
run: | | |
cd study-manifests | |
sed -i 's|image:.*|image: art.montkim.com/study/my-gitbook:${{ env.SHORT_SHA }}|' deployment.yaml | |
- name: Commit and push changes to 'study-manifests' | |
if: success() # 이전 단계가 성공한 경우에만 실행 | |
run: | | |
cd study-manifests | |
git config user.name "${{ github.actor }}" | |
git config user.email "${{ github.actor }}@users.noreply.github.com" | |
git add . | |
git commit -m "Update image tag to ${{ env.SHORT_SHA }}" | |
git push | |