From 9a5f11aace4718d3daac9482b8d20da1c0d9b99b Mon Sep 17 00:00:00 2001 From: Daniil <77277774+shamemask@users.noreply.github.com> Date: Tue, 3 Dec 2024 21:02:33 +0300 Subject: [PATCH] =?UTF-8?q?feat:=20=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=B8=D0=BB=20=D0=BF=D1=80=D0=BE=D1=81=D1=82=D0=B5=D0=BD=D1=8C?= =?UTF-8?q?=D0=BA=D0=BE=D0=B5=20=D1=80=D0=B0=D0=B7=D0=B2=D0=B5=D1=80=D1=82?= =?UTF-8?q?=D1=8B=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=B4=D0=BE=D0=BA=D0=B5?= =?UTF-8?q?=D1=80=D0=B0=20=D0=BD=D0=B0=20=D1=81=D0=B5=D1=80=D0=B2=D0=B5?= =?UTF-8?q?=D1=80=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{checks.yml => build-and-push.yml} | 29 +++---------------- .github/workflows/deploy.yml | 29 +++++++++++++++++++ .github/workflows/lint.yml | 25 ++++++++++++++++ 3 files changed, 58 insertions(+), 25 deletions(-) rename .github/workflows/{checks.yml => build-and-push.yml} (53%) create mode 100644 .github/workflows/deploy.yml create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/checks.yml b/.github/workflows/build-and-push.yml similarity index 53% rename from .github/workflows/checks.yml rename to .github/workflows/build-and-push.yml index 56f87db..b7efbfd 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/build-and-push.yml @@ -1,29 +1,12 @@ -name: Lint +name: Build and Push Docker Images on: - pull_request: push: branches: - main - - dev + - develop jobs: - eslint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 16 - - name: Install main deps - run: yarn - - name: Initialize - run: yarn lerna bootstrap - - name: Lint - run: yarn lint - - name: Test - run: yarn test - build-and-push: permissions: packages: write @@ -32,11 +15,7 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v2 - - name: set lower case owner name - run: | - echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV} - env: - OWNER: '${{ github.repository_owner }}' + - name: Login to GitHub Container Registry uses: docker/login-action@v1 with: @@ -51,4 +30,4 @@ jobs: file: .docker/server/Dockerfile target: prod push: true - tags: ghcr.io/${{ env.OWNER_LC }}/${{ github.event.repository.name }}/client:${{ github.sha }} \ No newline at end of file + tags: ghcr.io/${{ env.OWNER_LC }}/${{ github.event.repository.name }}/client:${{ github.sha }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..6e0cf84 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,29 @@ +name: Deploy to Server + +on: + push: + branches: + - main + - develop + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Deploy to server + uses: appleboy/ssh-action@v0.1.7 + with: + host: ${{ secrets.SERVER_HOST }} + username: ${{ secrets.SERVER_USER }} + key: ${{ secrets.SERVER_SSH_KEY }} + port: 22 + script: | + cd /home/falcon-tanks/falcon-tanks + git pull origin develop + docker image prune --force + docker system prune --all --volumes --force + docker-compose down --volumes --remove-orphans + docker-compose up --build -d diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..3869fa6 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,25 @@ +name: Lint and Test + +on: + pull_request: + push: + branches: + - main + - develop + +jobs: + eslint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + - name: Install main deps + run: yarn + - name: Initialize + run: yarn lerna bootstrap + - name: Lint + run: yarn lint + - name: Test + run: yarn test