From c2618a536773021b6a426b7a6aac47b4b6745eb3 Mon Sep 17 00:00:00 2001 From: mhmdksh Date: Fri, 21 Jun 2024 18:42:06 +0400 Subject: [PATCH] Adding a build step in CI --- .github/workflows/staging-deploy.yml | 27 ++++++++++++++++++++++++--- docker-compose.yml | 3 +-- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/.github/workflows/staging-deploy.yml b/.github/workflows/staging-deploy.yml index d43c230..4dcb2ee 100644 --- a/.github/workflows/staging-deploy.yml +++ b/.github/workflows/staging-deploy.yml @@ -6,7 +6,30 @@ on: - staging jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + push: true + tags: ghcr.io/GeneralMagicio/pw-backend:staging + deploy: + needs: publish runs-on: ubuntu-latest steps: - name: SSH and Redeploy Staging @@ -20,6 +43,4 @@ jobs: cd rpgf4-pw-backend docker-compose down -v docker image prune -a --force - git checkout staging - git pull origin staging - docker-compose up -d --build + docker-compose up -d diff --git a/docker-compose.yml b/docker-compose.yml index 479bff5..a0d7a9d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,8 +2,7 @@ version: '3' services: pw-backend: - build: - context: . + image: ghcr.io/GeneralMagicio/pw-backend:staging container_name: rpgf4-pw-backend restart: always ports: