diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml index 4a2c1be2..755e359a 100644 --- a/.github/workflows/deploy-prod.yml +++ b/.github/workflows/deploy-prod.yml @@ -14,8 +14,8 @@ concurrency: cancel-in-progress: false env: - REGISTRY: registry-pick.dsmhs.kr - IMAGE_NAME: registry-pick.dsmhs.kr/pick-core-prod + REGISTRY: docker.io + IMAGE_REPOSITORY: sungjujjang/pick-core-prod GITOPS_REPO: DSM-PICK/PICK-INFRA-APPLICATION GITOPS_VALUES_FILE: apps/prod/values.yaml DEPLOYMENT_NAME: pick-core-prod @@ -33,12 +33,12 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Login to registry + - name: Login to Docker Hub uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} - username: ${{ secrets.REGISTRY_USERNAME }} - password: ${{ secrets.REGISTRY_PASSWORD }} + username: sungjujjang + password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push image uses: docker/build-push-action@v6 @@ -48,8 +48,8 @@ jobs: platforms: linux/amd64 push: true tags: | - ${{ env.IMAGE_NAME }}:${{ github.sha }} - ${{ env.IMAGE_NAME }}:latest + ${{ env.IMAGE_REPOSITORY }}:${{ github.sha }} + ${{ env.IMAGE_REPOSITORY }}:latest cache-from: type=gha cache-to: type=gha,mode=max @@ -67,7 +67,7 @@ jobs: sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.54.1/yq_linux_amd64 sudo chmod +x /usr/local/bin/yq - - name: Update image tag in GitOps manifest + - name: Update image in GitOps manifest env: IMAGE_TAG: ${{ github.sha }} run: | @@ -81,6 +81,7 @@ jobs: exit 1 fi + yq -i "(.deployments[] | select(.name == \"${DEPLOYMENT_NAME}\") | .image.repository) = strenv(IMAGE_REPOSITORY)" "gitops/${GITOPS_VALUES_FILE}" yq -i "(.deployments[] | select(.name == \"${DEPLOYMENT_NAME}\") | .image.tag) = strenv(IMAGE_TAG)" "gitops/${GITOPS_VALUES_FILE}" - name: Commit and push GitOps manifest @@ -96,7 +97,7 @@ jobs: fi git -C gitops add "${GITOPS_VALUES_FILE}" - git -C gitops commit -m "chore(prod): update ${DEPLOYMENT_NAME} image tag to ${IMAGE_TAG}" + git -C gitops commit -m "chore(prod): update ${DEPLOYMENT_NAME} image to ${IMAGE_TAG}" git -C gitops fetch origin main git -C gitops rebase origin/main git -C gitops push origin HEAD:main diff --git a/.github/workflows/deploy-stag.yml b/.github/workflows/deploy-stag.yml index 52b26b9d..1e453095 100644 --- a/.github/workflows/deploy-stag.yml +++ b/.github/workflows/deploy-stag.yml @@ -14,8 +14,8 @@ concurrency: cancel-in-progress: false env: - REGISTRY: registry-pick.dsmhs.kr - IMAGE_NAME: registry-pick.dsmhs.kr/pick-core-stag + REGISTRY: docker.io + IMAGE_REPOSITORY: sungjujjang/pick-core-stag GITOPS_REPO: DSM-PICK/PICK-INFRA-APPLICATION GITOPS_VALUES_FILE: apps/stag/values.yaml DEPLOYMENT_NAME: pick-core-stag @@ -33,12 +33,12 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Login to registry + - name: Login to Docker Hub uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} - username: ${{ secrets.REGISTRY_USERNAME }} - password: ${{ secrets.REGISTRY_PASSWORD }} + username: sungjujjang + password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push image uses: docker/build-push-action@v6 @@ -48,8 +48,8 @@ jobs: platforms: linux/amd64 push: true tags: | - ${{ env.IMAGE_NAME }}:${{ github.sha }} - ${{ env.IMAGE_NAME }}:latest + ${{ env.IMAGE_REPOSITORY }}:${{ github.sha }} + ${{ env.IMAGE_REPOSITORY }}:latest cache-from: type=gha cache-to: type=gha,mode=max @@ -67,7 +67,7 @@ jobs: sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.54.1/yq_linux_amd64 sudo chmod +x /usr/local/bin/yq - - name: Update image tag in GitOps manifest + - name: Update image in GitOps manifest env: IMAGE_TAG: ${{ github.sha }} run: | @@ -81,6 +81,7 @@ jobs: exit 1 fi + yq -i "(.deployments[] | select(.name == \"${DEPLOYMENT_NAME}\") | .image.repository) = strenv(IMAGE_REPOSITORY)" "gitops/${GITOPS_VALUES_FILE}" yq -i "(.deployments[] | select(.name == \"${DEPLOYMENT_NAME}\") | .image.tag) = strenv(IMAGE_TAG)" "gitops/${GITOPS_VALUES_FILE}" - name: Commit and push GitOps manifest @@ -96,7 +97,7 @@ jobs: fi git -C gitops add "${GITOPS_VALUES_FILE}" - git -C gitops commit -m "chore(stag): update ${DEPLOYMENT_NAME} image tag to ${IMAGE_TAG}" + git -C gitops commit -m "chore(stag): update ${DEPLOYMENT_NAME} image to ${IMAGE_TAG}" git -C gitops fetch origin main git -C gitops rebase origin/main git -C gitops push origin HEAD:main