From 1364d02816052fd7edf7c7ae219f8c1256fc05ac Mon Sep 17 00:00:00 2001 From: pricelees Date: Thu, 10 Jul 2025 18:12:14 +0900 Subject: [PATCH] feat: add deploy scripts on workflows --- .gitea/workflows/integration-deploy.yaml | 64 ++++++++++++++++++++++++ .gitea/workflows/integration.yaml | 30 ----------- 2 files changed, 64 insertions(+), 30 deletions(-) create mode 100644 .gitea/workflows/integration-deploy.yaml delete mode 100644 .gitea/workflows/integration.yaml diff --git a/.gitea/workflows/integration-deploy.yaml b/.gitea/workflows/integration-deploy.yaml new file mode 100644 index 0000000..659332d --- /dev/null +++ b/.gitea/workflows/integration-deploy.yaml @@ -0,0 +1,64 @@ +name: Build + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Docker Login + uses: docker/login-action@v3 + with: + registry: ${{ secrets.DOCKER_REGISTRY }} + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push image + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + platforms: linux/amd64 + push: true + tags: ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_IMAGE }}:${{ gitea.sha }} + + update-deployment: + runs-on: ubuntu-latest + needs: build + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + # 이 Repository에 업로드된 helm과 유사하게 + repository: ${{ secrets.DEPLOYMENT_REPOSITORY }} + token: ${{ secrets.ACCESS_TOKEN }} + ref: ${{ secrets.DEPLOYMENT_BRANCH }} + + - name: Update Image Tag + run: | + yq e '${{ secrets.TRIGGER_PROPS }} = "${{ gitea.sha }}"' -i ${{ secrets.TRIGGER_PATH }} + + - name: Commit Changes + run: | + git config --local user.name "Gitea Action" + git config --local user.email "actions@gitea.local" + git add ${{ secrets.TRIGGER_PATH }} + if ! git diff --staged --quiet; then + echo "Changes detected, committing..." + git commit -m "Update trigger props to ${{ gitea.sha }} for deployment" + git push + else + echo "No changes detected, skipping commit." + fi + + + + diff --git a/.gitea/workflows/integration.yaml b/.gitea/workflows/integration.yaml deleted file mode 100644 index 1d32750..0000000 --- a/.gitea/workflows/integration.yaml +++ /dev/null @@ -1,30 +0,0 @@ -name: Build - -on: - push: - branches: - - main - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Docker Login - uses: docker/login-action@v3 - with: - registry: ${{ secrets.DOCKER_REGISTRY }} - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Build and push image - uses: docker/build-push-action@v6 - with: - context: . - file: ./Dockerfile - platforms: linux/amd64 - push: true - tags: ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_IMAGE }}:${{ gitea.sha }} \ No newline at end of file