From 47c2f813e5ec82bafa5adcffb23f8d748249f9ae Mon Sep 17 00:00:00 2001 From: violet-dev Date: Sat, 21 Sep 2024 15:00:26 +0900 Subject: [PATCH] Recover violet-server cd --- .../workflows/server-cd.yml | 39 +++++++++++++++---- 1 file changed, 31 insertions(+), 8 deletions(-) rename violet-server/.github/workflows/ci.yaml => .github/workflows/server-cd.yml (64%) diff --git a/violet-server/.github/workflows/ci.yaml b/.github/workflows/server-cd.yml similarity index 64% rename from violet-server/.github/workflows/ci.yaml rename to .github/workflows/server-cd.yml index 4b01d5d87..d36f859bd 100644 --- a/violet-server/.github/workflows/ci.yaml +++ b/.github/workflows/server-cd.yml @@ -1,15 +1,37 @@ -name: ci +name: Server CD on: push: branches: - - 'master' - paths-ignore: - - 'README.md' + - "dev" workflow_dispatch: jobs: - docker: + server-changes: + runs-on: ubuntu-latest + # Required permissions + permissions: + pull-requests: read + # Set job outputs to values from filter step + outputs: + src: ${{ steps.filter.outputs.src }} + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }} + + # For pull requests it's not necessary to checkout the code + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + src: + - ".github/workflows/server-cd.yml" + - "violet-server/**" + + deploy-by-docker: + needs: server-changes + if: ${{ needs.app-changes.outputs.src == 'true' }} runs-on: ubuntu-latest steps: - name: checkout @@ -32,6 +54,7 @@ jobs: - name: Build and push uses: docker/build-push-action@v3 with: + context: "{{defaultContext}}:violet-server" push: true tags: violetdev/violet:latest @@ -39,7 +62,7 @@ jobs: uses: fjogeleit/http-request-action@v1 with: url: ${{ secrets.WEBHOOK_URL }} - method: 'POST' + method: "POST" timeout: 60000 - name: CD Success @@ -51,7 +74,7 @@ jobs: color: 0x28e1ff nodetail: true description: | - Commit: [${{ github.event.head_commit.message }}](https://github.com/project-violet/violet-server-nest/commit/${{ github.sha }}) + Commit: [${{ github.event.head_commit.message }}](https://github.com/project-violet/violet-server/commit/${{ github.sha }}) CI Log: [${{ github.ref }} / ${{ github.sha }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) - name: CD Fail @@ -64,5 +87,5 @@ jobs: color: 0xff9300 content: "<@614104830738169877>" description: | - Commit: [${{ github.event.head_commit.message }}](https://github.com/project-violet/violet-server-nest/commit/${{ github.sha }}) + Commit: [${{ github.event.head_commit.message }}](https://github.com/project-violet/violet-server/commit/${{ github.sha }}) CI Log: [${{ github.ref }} / ${{ github.sha }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})