diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 68876ce..fc9cd68 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -1,73 +1,47 @@ -name: Deploy Telegram Bot - -on: - push: - branches: - - main - -env: - VERSION: 1.0.0 - -jobs: - # ЧАСТЬ 1: Собираем образы и кладем в Gitea (чтобы делиться с ребятами) - build-and-push: - runs-on: ubuntu-latest # Замени на метку твоего раннера, если она другая - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Login to Gitea Container Registry - uses: docker/login-action@v3 - with: - registry: git.codeanddice.ru # НАПРИМЕР: gitea.my-server.com - username: toutsu - password: ${{ secrets.GIT_TOKEN }} - - - name: Build and push Bot - uses: docker/build-push-action@v5 - with: - context: . - file: src/GmRelay.Bot/Dockerfile - push: true - tags: | - git.codeanddice.ru/toutsu/gmrelay-bot:latest - git.codeanddice.ru/toutsu/gmrelay-bot:${{ env.VERSION }} - labels: | - org.opencontainers.image.source=https://git.codeanddice.ru/${{ gitea.repository }} - - - name: Build and push Web - uses: docker/build-push-action@v5 - with: - context: . - file: src/GmRelay.Web/Dockerfile - push: true - tags: | - git.codeanddice.ru/toutsu/gmrelay-web:latest - git.codeanddice.ru/toutsu/gmrelay-web:${{ env.VERSION }} - labels: | - org.opencontainers.image.source=https://git.codeanddice.ru/${{ gitea.repository }} - - # ЧАСТЬ 2: Запускаем эти образы на самом сервере - deploy: - needs: build-and-push - runs-on: ubuntu-latest # Тот же локальный раннер - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Create .env file with secrets - run: | - echo "TELEGRAM_BOT_TOKEN=${{ secrets.TELEGRAM_BOT_TOKEN }}" > .env - echo "POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }}" >> .env - echo "TELEGRAM_BOT_USERNAME=${{ secrets.TELEGRAM_BOT_USERNAME }}" >> .env - - - name: Deploy Containers - run: | - # Авторизуемся локальным докером в нашей Gitea - docker login git.codeanddice.ru/ -u toutsu -p ${{ secrets.GIT_TOKEN }} - - # Pull гарантирует, что мы получили нужную версию. - docker compose pull bot web - - # Запускаем! Флаг -d оставит их работать в фоне. - docker compose up -d \ No newline at end of file +name: Deploy Telegram Bot + +on: + push: + branches: + - fix-1.0.0-image + +env: + VERSION: 1.0.0 + +jobs: + # ЧАСТЬ 1: Собираем образы и кладем в Gitea (чтобы делиться с ребятами) + build-and-push: + runs-on: ubuntu-latest # Замени на метку твоего раннера, если она другая + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Login to Gitea Container Registry + uses: docker/login-action@v3 + with: + registry: git.codeanddice.ru # НАПРИМЕР: gitea.my-server.com + username: toutsu + password: ${{ secrets.GIT_TOKEN }} + + - name: Build and push Bot + uses: docker/build-push-action@v5 + with: + context: . + file: src/GmRelay.Bot/Dockerfile + push: true + tags: | + git.codeanddice.ru/toutsu/gmrelay-bot:${{ env.VERSION }} + labels: | + org.opencontainers.image.source=https://git.codeanddice.ru/${{ gitea.repository }} + + - name: Build and push Web + uses: docker/build-push-action@v5 + with: + context: . + file: src/GmRelay.Web/Dockerfile + push: true + tags: | + git.codeanddice.ru/toutsu/gmrelay-web:${{ env.VERSION }} + labels: | + org.opencontainers.image.source=https://git.codeanddice.ru/${{ gitea.repository }} + \ No newline at end of file