From af9c55e4b16c4f540e62853e10549a0946458faf Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sat, 9 Dec 2023 20:59:31 +0100 Subject: [PATCH] Updated dev action --- .gitea/workflows/deploy_dev.yaml | 87 +++++++++++++++++++++++++------- 1 file changed, 69 insertions(+), 18 deletions(-) diff --git a/.gitea/workflows/deploy_dev.yaml b/.gitea/workflows/deploy_dev.yaml index 97b6c4d1..4a2ede6b 100644 --- a/.gitea/workflows/deploy_dev.yaml +++ b/.gitea/workflows/deploy_dev.yaml @@ -6,9 +6,17 @@ on: - dev jobs: - on-push-deploy_sh-edraft: + pre-build: runs-on: [ dobby.sh-edraft.de, ubuntu-latest ] - container: sh-edraft.de/act-runner:latest + container: git.sh-edraft.de/sh-edraft.de/act-runner:latest + steps: + - name: Shutdown stack + run: docker stack rm sdb_dev + + build-bot: + needs: pre-build + runs-on: [ dobby.sh-edraft.de, ubuntu-latest ] + container: git.sh-edraft.de/sh-edraft.de/act-runner:latest steps: - name: Setup docker uses: https://github.com/papodaca/install-docker-action@main @@ -20,12 +28,56 @@ jobs: token: ${{ secrets.CI_ACCESS_TOKEN }} submodules: true + - name: Set version + run: | + cd bot/docker + chmod +x ./set-docker-compose-image-version.sh + ./set-docker-compose-image-version.sh sh-edraft.de/sdb-bot:$(cd ../; cpl gv)-dev sh-edraft.de/sdb-web:$(cd ../../web; npm run -s gv;)-dev + - name: Prepare bot build run: | cd bot python3.10 -m pip install --extra-index-url https://pip.sh-edraft.de cpl-cli cpl i + - name: Build docker bot + run: | + cd bot + docker image prune -f + cpl build + docker build -t git.sh-edraft.de/sh-edraft.de/sdb-bot:$(cpl gv)-dev . + + - name: Login to registry git.sh-edraft.de + uses: https://github.com/docker/login-action@v1 + with: + registry: git.sh-edraft.de + username: ${{ secrets.CI_USERNAME }} + password: ${{ secrets.CI_ACCESS_TOKEN }} + + - name: Push image + run: docker push git.sh-edraft.de/sh-edraft.de/sdb-bot:$(cpl gv)-dev + + build-web: + needs: pre-build + runs-on: [ dobby.sh-edraft.de, ubuntu-latest ] + container: git.sh-edraft.de/sh-edraft.de/act-runner:latest + steps: + - name: Setup docker + uses: https://github.com/papodaca/install-docker-action@main + - run: docker -v + + - name: Clone Repository + uses: https://github.com/actions/checkout@v3 + with: + token: ${{ secrets.CI_ACCESS_TOKEN }} + submodules: true + + - name: Set version + run: | + cd bot/docker + chmod +x ./set-docker-compose-image-version.sh + ./set-docker-compose-image-version.sh sh-edraft.de/sdb-bot:$(cd ../; cpl gv)-dev sh-edraft.de/sdb-web:$(cd ../../web; npm run -s gv;)-dev + - name: Setup node uses: https://github.com/actions/setup-node@v3 @@ -35,30 +87,29 @@ jobs: npm install -g ts-node npm ci - - name: Shutdown stack - run: docker stack rm sdb_dev - - - name: Build docker bot - run: | - cd bot - docker image prune -f - cpl build - docker build -t sh-edraft.de/sdb-bot:$(cpl gv)-dev . - - name: Build docker web run: | cd web docker image prune -f cp src/favicon.dev.ico src/favicon.ico npm run build - docker build -t sh-edraft.de/sdb-web:$(npm run -s gv)-dev . + docker build -t git.sh-edraft.de/sh-edraft.de/sdb-web:$(npm run -s gv)-dev . - - name: Set version - run: | - cd bot/docker - chmod +x ./set-docker-compose-image-version.sh - ./set-docker-compose-image-version.sh sh-edraft.de/sdb-bot:$(cd ../; cpl gv)-dev sh-edraft.de/sdb-web:$(cd ../../web; npm run -s gv;)-dev + - name: Login to registry git.sh-edraft.de + uses: https://github.com/docker/login-action@v1 + with: + registry: git.sh-edraft.de + username: ${{ secrets.CI_USERNAME }} + password: ${{ secrets.CI_ACCESS_TOKEN }} + - name: Push image + run: docker build -t git.sh-edraft.de/sh-edraft.de/sdb-web:$(npm run -s gv)-dev + + deploy: + needs: [ build-bot, build-web ] + runs-on: [ dobby.sh-edraft.de, ubuntu-latest ] + container: git.sh-edraft.de/sh-edraft.de/act-runner:latest + steps: - name: Deploy Stack to sh-edraft.de uses: https://github.com/kgierke/portainer-stack-deployment@v1 with: