From c6993cf6557931dcb3ebb281ab18ccfcaee02f0c Mon Sep 17 00:00:00 2001 From: Zafei-Erin <897659752@qq.com> Date: Fri, 3 May 2024 23:16:45 +0800 Subject: [PATCH] simplify backend cicd workflow --- .github/workflows/Backend-cd.yml | 66 +++++++++++++++--------------- .github/workflows/Backend-ci .yml | 46 ++++++++++----------- .github/workflows/Frontend-ci.yaml | 4 +- 3 files changed, 59 insertions(+), 57 deletions(-) diff --git a/.github/workflows/Backend-cd.yml b/.github/workflows/Backend-cd.yml index f8d38eb..4c7b580 100644 --- a/.github/workflows/Backend-cd.yml +++ b/.github/workflows/Backend-cd.yml @@ -1,38 +1,40 @@ -name: Backend-cd +# CD is removed from AWS to vercel -on: - workflow_run: - workflows: ['Backend-ci'] - types: [completed] - branches: [main] - pull_request: - types: [labeled] +# name: Backend-cd -jobs: - deploy-git: - runs-on: ubuntu-latest +# on: +# workflow_run: +# workflows: ['Backend-ci'] +# types: [completed] +# branches: [main] +# pull_request: +# types: [labeled] - steps: - - name: Checkout - uses: actions/checkout@v4 +# jobs: +# deploy-git: +# runs-on: ubuntu-latest - - name: Remove deploy label - uses: actions-ecosystem/action-remove-labels@v1 - with: - labels: "prod: backend" +# steps: +# - name: Checkout +# uses: actions/checkout@v4 - deploy-aws: - needs: deploy-git - runs-on: aws-nft +# - name: Remove deploy label +# uses: actions-ecosystem/action-remove-labels@v1 +# with: +# labels: "prod: backend" - steps: - - name: stop old image - run: sudo docker-compose stop - - name: remove old image - run: sudo docker-compose rm -f - - name: pull new image - run: sudo docker-compose pull - - name: run new image - run: sudo docker-compose up -d - - name: prune images - run: sudo docker image prune -af \ No newline at end of file + # deploy-aws: + # needs: deploy-git + # runs-on: aws-nft + + # steps: + # - name: stop old image + # run: sudo docker-compose stop + # - name: remove old image + # run: sudo docker-compose rm -f + # - name: pull new image + # run: sudo docker-compose pull + # - name: run new image + # run: sudo docker-compose up -d + # - name: prune images + # run: sudo docker image prune -af \ No newline at end of file diff --git a/.github/workflows/Backend-ci .yml b/.github/workflows/Backend-ci .yml index 6c3f4b2..aaffc23 100644 --- a/.github/workflows/Backend-ci .yml +++ b/.github/workflows/Backend-ci .yml @@ -3,10 +3,10 @@ name: Backend-ci on: push: branches: [main] - paths: "backend/**" + paths: ["backend/**"] pull_request: types: [opened, synchronize, reopened] - paths: "backend/**" + paths: ["backend/**"] jobs: git-ci: @@ -36,29 +36,29 @@ jobs: run: npm ci working-directory: "backend" - docker-push: - needs: git-ci - runs-on: ubuntu-latest + # docker-push: + # needs: git-ci + # runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 + # steps: + # - name: Checkout + # uses: actions/checkout@v4 - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + # - name: Login to Docker Hub + # uses: docker/login-action@v3 + # with: + # username: ${{ secrets.DOCKERHUB_USERNAME }} + # password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + # - name: Set up Docker Buildx + # uses: docker/setup-buildx-action@v3 - - name: print location - run: pwd + # - name: print location + # run: pwd - - name: Build and push - uses: docker/build-push-action@v5 - with: - context: ./backend - push: true - tags: ${{ secrets.DOCKERHUB_USERNAME }}/nft-mkp-api:latest + # - name: Build and push + # uses: docker/build-push-action@v5 + # with: + # context: ./backend + # push: true + # tags: ${{ secrets.DOCKERHUB_USERNAME }}/nft-mkp-api:latest diff --git a/.github/workflows/Frontend-ci.yaml b/.github/workflows/Frontend-ci.yaml index 34ac641..58d4db4 100644 --- a/.github/workflows/Frontend-ci.yaml +++ b/.github/workflows/Frontend-ci.yaml @@ -3,10 +3,10 @@ name: Frontend-ci on: push: branches: [main] - paths: 'frontend/**' + paths: ['frontend/**'] pull_request: types: [opened, synchronize, reopened] - paths: 'frontend/**' + paths: ['frontend/**'] jobs: git-ci: