From 16d6264098c6f3c9bc3ba28c8016d84d475a1527 Mon Sep 17 00:00:00 2001 From: Muninn Date: Tue, 7 Jan 2025 20:49:13 +0800 Subject: [PATCH] ci: fix deploy bug --- .github/workflows/build.yml | 3 +- .github/workflows/testnet-dev.yml | 140 ------------------------------ 2 files changed, 1 insertion(+), 142 deletions(-) delete mode 100644 .github/workflows/testnet-dev.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8521441..c61c17c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,8 +3,6 @@ name: Build Docker Image and Deploy on: push: branches: [ main ] - tags: - - "v*.*.*" paths-ignore: - '.github/**' - 'docs/**' @@ -17,6 +15,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: read + id-token: write steps: - name: Build Start id: ci_start diff --git a/.github/workflows/testnet-dev.yml b/.github/workflows/testnet-dev.yml deleted file mode 100644 index a8baa60..0000000 --- a/.github/workflows/testnet-dev.yml +++ /dev/null @@ -1,140 +0,0 @@ -name: Build Docker Image and Deploy to TestnetDev - -on: - push: - branches: [ release/carbon/testnet-dev ] - paths-ignore: - - '.github/**' - - 'docs/**' - - '*.md' - -jobs: - docker: - runs-on: ubuntu-latest - permissions: - contents: read - steps: - - name: Build Start - id: ci_start - uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d - with: - method: chat.postMessage - token: ${{ secrets.SLACK_BOT_TOKEN }} - payload: | - channel: ${{ secrets.SLACK_CHANNEL }} - text: "Build started 👀" - attachments: - - color: "dbab09" - fields: - - title: "Repository" - short: true - value: ${{ github.repository }} - - title: "Status" - short: true - value: "In Progress" - - title: "Branch" - short: true - value: ${{ github.ref }} - - title: "Author" - short: true - value: ${{ github.actor }} - - title: "Action" - value: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - - title: "Diff" - value: ${{ github.event.head_commit.url }} - - title: "Changes" - value: ${{ toJSON(github.event.head_commit.message) }} - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 - with: - aws-region: ${{ secrets.AWS_REGION }} - role-to-assume: arn:aws:iam::${{ secrets.AWS_ID }}:role/GithubActions - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 - - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 - - - name: Build and push - uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 - with: - build-args: | - RELEASE=${{ github.sha }} - push: true - tags: ${{ secrets.AWS_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/intentkit:${{ github.sha }},${{ secrets.AWS_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/intentkit:testnet-dev - cache-from: type=gha - cache-to: type=gha,mode=max - - - name: Deploy to Amazon EKS - run: | - aws eks update-kubeconfig --region ${{ secrets.AWS_REGION }} --name crestal-production - kubectl version - kubectl set image -n testnet-dev deployment/intent-api intent-api=${{ secrets.AWS_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/intentkit:${{ github.sha }} - kubectl set image -n testnet-dev deployment/intent-autonomous intent-autonomous=${{ secrets.AWS_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/intentkit:${{ github.sha }} - - - name: Build Success - if: ${{ success() }} - uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d - with: - method: chat.update - token: ${{ secrets.SLACK_BOT_TOKEN }} - payload: | - channel: ${{ secrets.SLACK_CHANNEL }} - ts: "${{ steps.ci_start.outputs.ts }}" - text: "Build Succeeded ✅" - attachments: - - color: "28a745" - fields: - - title: "Repository" - short: true - value: ${{ github.repository }} - - title: "Status" - short: true - value: "Completed" - - title: "Branch" - short: true - value: ${{ github.ref }} - - title: "Author" - short: true - value: ${{ github.actor }} - - title: "Image" - value: ${{ secrets.AWS_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/intentkit:${{ github.sha }} - - title: "Diff" - value: ${{ github.event.head_commit.url }} - - title: "Changes" - value: ${{ toJSON(github.event.head_commit.message) }} - - - name: Build Failure - if: ${{ failure() }} - uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d - with: - method: chat.update - token: ${{ secrets.SLACK_BOT_TOKEN }} - payload: | - channel: ${{ secrets.SLACK_CHANNEL }} - ts: "${{ steps.ci_start.outputs.ts }}" - text: "Build Failed ❌" - attachments: - - color: "dc3545" - fields: - - title: "Repository" - short: true - value: ${{ github.repository }} - - title: "Status" - short: true - value: "Failed" - - title: "Branch" - short: true - value: ${{ github.ref }} - - title: "Author" - short: true - value: ${{ github.actor }} - - title: "Action" - value: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - - title: "Diff" - value: ${{ github.event.head_commit.url }} - - title: "Changes" - value: ${{ toJSON(github.event.head_commit.message) }}