From 3f7de5e46f0468e83da812c9999aab0d25f4e1a6 Mon Sep 17 00:00:00 2001 From: dtuchs Date: Thu, 20 Jun 2024 17:02:41 +0300 Subject: [PATCH] gha --- .github/workflows/e2e.yml | 60 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/e2e.yml diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml new file mode 100644 index 0000000..6a5955f --- /dev/null +++ b/.github/workflows/e2e.yml @@ -0,0 +1,60 @@ +name: e2e + +on: + push: + branches-ignore: + - master +jobs: + deploy-services: + runs-on: self-hosted + - name: Check changes path + uses: dorny/paths-filter@v3 + id: changes + with: + filters: | + auth: + - 'rococo-auth/**' + api: + - 'rococo-api/**' + client: + - 'rococo-client/**' + + - name: Docker login + run: | + docker login --username ${{ vars.DOCKER_HUB_ACC }} --password "${{ secrets.DOCKER_HUB_PASSWORD }}" + + - name: build auth & deploy to staging + if: steps.changes.outputs.auth == 'true' + working-directory: ./ + run: | + pwd + bash ./gradlew :rococo-auth:jib -Pskipjaxb -x :rococo-e2e:test + docker-compose pull auth.rococo.dc + docker-compose stop auth.rococo.dc && docker-compose up -d --no-deps auth.rococo.dc + docker system prune -a -f + echo "Deploy auth to stage done!" + + - name: build currency & deploy to staging + if: steps.changes.outputs.api == 'true' + working-directory: ./ + run: | + pwd + bash ./gradlew :rococo-api:jib -Pskipjaxb -x :rococo-e2e:test + docker-compose pull api.rococo.dc + docker-compose stop api.rococo.dc && docker-compose up -d --no-deps api.rococo.dc + docker system prune -a -f + echo "Deploy api to stage done!" + + - name: build frontend & deploy to staging + if: steps.changes.outputs.client == 'true' + working-directory: ./rococo-client + run: | + pwd + docker build -t ${{ vars.DOCKER_HUB_ACC }}/rococo-client:0.0.1-SNAPSHOT -t ${{ vars.DOCKER_HUB_ACC }}/rococo-client:latest . + docker push ${{ vars.DOCKER_HUB_ACC }}/rococo-client:0.0.1-SNAPSHOT + docker push ${{ vars.DOCKER_HUB_ACC }}/rococo-client:latest + cd ../ || exit 1 + docker-compose pull client.rococo.dc + docker-compose stop client.rococo.dc && docker-compose up -d --no-deps client.rococo.dc + docker system prune -a -f + echo "Deploy frontend to stage done!"