fix: remove goroutine in transaction #112
This file contains hidden or 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: DEV CI/CD Pipeline | |
| on: | |
| push: | |
| branches: | |
| - dev | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Cache Docker layers | |
| uses: actions/cache@v3 | |
| with: | |
| path: /tmp/.buildx-cache | |
| key: ${{ runner.os }}-buildx-${{ github.sha }} | |
| restore-keys: | | |
| ${{ runner.os }}-buildx- | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.24' | |
| - name: Cache Go binaries | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| $HOME/.cache/go-build | |
| $HOME/go/pkg/mod | |
| $HOME/go/bin | |
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-go- | |
| - name: Install sqlc | |
| run: go install github.com/sqlc-dev/sqlc/cmd/sqlc@v1.29 | |
| - name: Generate Go code from SQL | |
| run: sqlc generate | |
| - name: Log in to Google Cloud | |
| uses: google-github-actions/auth@v1 | |
| with: | |
| credentials_json: ${{ secrets.ORG_DEV_GCP_CREDENTIALS }} | |
| - name: Configure docker for gcloud | |
| run: gcloud auth configure-docker asia-northeast3-docker.pkg.dev | |
| - name: Build and push Docker image | |
| run: | | |
| docker buildx build --push \ | |
| --tag asia-northeast3-docker.pkg.dev/${{ secrets.ORG_DEV_GCP_PROJECT_ID }}/${{ secrets.ORG_DEV_GCP_REGISTRY_NAME }}/teleport-plugin-slack-access-request-dev:${{ github.sha }}${{ github.run_attempt }} . | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Checkout deployment repo | |
| uses: actions/checkout@v3 | |
| with: | |
| repository: teletwoboy/teletwoboy-manifest | |
| path: manifests | |
| token: ${{ secrets.ORG_GITHUB_KEY }} | |
| - name: Update manifest | |
| run: | | |
| sed -i "s|image: .*|image: asia-northeast3-docker.pkg.dev/${{ secrets.ORG_DEV_GCP_PROJECT_ID }}/${{ secrets.ORG_DEV_GCP_REGISTRY_NAME }}/teleport-plugin-slack-access-request-dev:${{ github.sha }}${{ github.run_attempt }}|" manifests/dev/teleport-plugin-slack-access-request/deployment.yaml | |
| - name: Commit and push changes | |
| working-directory: manifests | |
| run: | | |
| git config --global user.name 'github-actions' | |
| git config --global user.email 'github-actions@github.com' | |
| git add . | |
| git commit -m "Update image to asia-northeast3-docker.pkg.dev/${{ secrets.ORG_DEV_GCP_PROJECT_ID }}/${{ secrets.ORG_DEV_GCP_REGISTRY_NAME }}/teleport-plugin-slack-access-request-dev:${{ github.sha }}${{ github.run_attempt }}" | |
| git push | |
| notify: | |
| name: Notify Discord | |
| runs-on: ubuntu-latest | |
| needs: [build, deploy] | |
| if: always() | |
| steps: | |
| - name: Send Discord Notification | |
| run: | | |
| if [ "${{ needs.build.result }}" == "success" ] && [ "${{ needs.deploy.result }}" == "success" ]; then | |
| STATUS="✅ 배포 성공" | |
| else | |
| STATUS="❌ 배포 실패" | |
| fi | |
| curl -H "Content-Type: application/json" \ | |
| -X POST \ | |
| -d "{ | |
| \"content\": \"${STATUS} \n\ | |
| \`1. Repository\`: \`${{ github.repository }}\`\n\ | |
| \`2. Run Branch\`: \`dev\`\n\ | |
| \`3. Run Attempt\`: \`${{ github.run_attempt }}\`\n\ | |
| \`4. Commit\`: <https://github.com/${{ github.repository }}/commit/${{ github.sha }}>\" | |
| }" \ | |
| ${{ secrets.ORG_DEV_DISCORD_WEBHOOK_URL }} |