From 8233e34b7440695be04c62cddbb27c2894d3c073 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Ioni=C8=9B=C4=83?= Date: Tue, 18 Jun 2024 11:45:53 +0100 Subject: [PATCH] ci: update workflows --- .github/workflows/build-image.yml | 20 +++++++++++++ .github/workflows/build.yml | 31 ------------------- .github/workflows/dockerhub.yml | 49 ------------------------------- .github/workflows/pipeline.yml | 35 ---------------------- 4 files changed, 20 insertions(+), 115 deletions(-) create mode 100644 .github/workflows/build-image.yml delete mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/dockerhub.yml delete mode 100644 .github/workflows/pipeline.yml diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml new file mode 100644 index 00000000..6e3c2203 --- /dev/null +++ b/.github/workflows/build-image.yml @@ -0,0 +1,20 @@ +on: + push: + branches: + - 'main' + - '1.x' + tags: + - 'v*' + +name: Build Docker image + +jobs: + build: + name: Build Docker image + uses: code4romania/.github/.github/workflows/build-push-image.yml@main + with: + images: code4romania/votong + dockerfile: ./docker/web/Dockerfile + secrets: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + token: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 3e972482..00000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Transfer to staging env and run - -on: - push: - branches: - - develop - - main - -jobs: - build: - name: Transfer to dev env and run - runs-on: ubuntu-latest - - steps: - - name: executing remote ssh commands on dev env - if: github.ref == 'refs/heads/develop' - uses: appleboy/ssh-action@master - with: - host: ${{ secrets.DEV_SERVER_IP }} - username: ${{ secrets.DEV_SERVER_SSH_USERNAME }} - key: ${{ secrets.DEV_SERVER_SSH_KEY }} - script: "/root/votong/deploy/pull.sh" - - - name: executing remote ssh commands on production env - if: github.ref == 'refs/heads/main' - uses: appleboy/ssh-action@master - with: - host: ${{ secrets.PROD_SERVER_IP }} - username: ${{ secrets.PROD_SERVER_SSH_USERNAME }} - key: ${{ secrets.PROD_SERVER_SSH_KEY }} - script: "/home/ubuntu/civil_society_vote/deploy/pull.sh" diff --git a/.github/workflows/dockerhub.yml b/.github/workflows/dockerhub.yml deleted file mode 100644 index 6fefc167..00000000 --- a/.github/workflows/dockerhub.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Publish on Dockerhub - -on: - push: - tags: - - "v*" - -env: - DOCKER_IMAGE_BASE: code4romania/votong - -jobs: - build-dockerimage: - name: Build Docker container - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Cache Docker layers - uses: actions/cache@v2 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-buildx- - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v1 - - - name: Login to Docker Hub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKER_HUB_USERNAME }} - password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - - - name: Set tag env - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - - - name: Build and push - id: docker_build - uses: docker/build-push-action@v2 - with: - context: ./ - file: ./docker/web/Dockerfile - builder: ${{ steps.buildx.outputs.name }} - push: true - tags: ${{ env.DOCKER_IMAGE_BASE }}:latest,${{ env.DOCKER_IMAGE_BASE }}:${{ env.RELEASE_VERSION }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache \ No newline at end of file diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml deleted file mode 100644 index b67c7a8c..00000000 --- a/.github/workflows/pipeline.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Lint - -on: - push: - branches: - - 'main' - - 'develop' - paths: - - '**.py' - - '**/requirements*.in' - - '**/requirements*.txt' - pull_request: - paths: - - '**.py' - - '**/requirements*.in' - - '**/requirements*.txt' - -jobs: - static_analysis: - runs-on: ubuntu-latest - container: python:3.9-slim-buster - - steps: - - uses: actions/checkout@v2 - - name: Install dependencies - run: | - python -m pip install -U pip - cat requirements-dev.txt | grep isort== | cut -d' ' -f1 | xargs pip install - cat requirements-dev.txt | grep black== | cut -d' ' -f1 | xargs pip install - - name: Check code formatting with black - run: | - black --check . - - name: Check imports order with isort - run: | - isort --check .