From ec60cc175621640dc585e60f25d365fa30b0e380 Mon Sep 17 00:00:00 2001 From: IgorVolochay Date: Sat, 8 Mar 2025 20:09:24 +0300 Subject: [PATCH] feat: create prebuild github actions --- .github/workflows/mypy-test.yml | 22 ------------------ .github/workflows/prebuild.yml | 41 +++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 22 deletions(-) delete mode 100644 .github/workflows/mypy-test.yml create mode 100644 .github/workflows/prebuild.yml diff --git a/.github/workflows/mypy-test.yml b/.github/workflows/mypy-test.yml deleted file mode 100644 index 0ac5f6c..0000000 --- a/.github/workflows/mypy-test.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: mypy-test - -on: - push: - paths: - - '**.py' - -jobs: - mypy: - runs-on: ubuntu-latest - steps: - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: 3.9 - architecture: x64 - - name: Checkout - uses: actions/checkout@v3 - - name: Install mypy - run: pip install mypy - - name: Run mypy - run: mypy --ignore-missing-imports ./app diff --git a/.github/workflows/prebuild.yml b/.github/workflows/prebuild.yml new file mode 100644 index 0000000..dcc2734 --- /dev/null +++ b/.github/workflows/prebuild.yml @@ -0,0 +1,41 @@ +name: Prebuild Workflow + +on: + pull_request: + branches: + - prebuild + +jobs: + test_build: + name: Test build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Try to build project + run: docker-compose up --build + + deploy_to_test_server: + name: Deploy to test server + needs: test_build + runs-on: ubuntu-latest + steps: + - name: Deploy to test server + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.TEST_SERVER_ADDRESS }} + username: ${{ secrets.TEST_SERVER_USER }} + port: ${{ secrets.TEST_SERVER_PORT }} + password: ${{ secrets.TEST_SERVER_PASSWORD }} + script: | + REPO_NAME=$(basename "${{ github.repository }}") + if [ ! -d "$REPO_NAME" ]; then + git clone https://github.com/${{ github.repository }}.git $REPO_NAME + fi + cd $REPO_NAME + + git checkout prebuild + git pull + + docker-compose down || true + docker-compose up -d --build