From 7a6c81600f389518f01fd354a0f6dbaa60ca6d2e Mon Sep 17 00:00:00 2001 From: "alireza.hassani" Date: Tue, 12 May 2026 14:51:00 +0000 Subject: [PATCH] Add .gitea/workflows/publish.yml --- .gitea/workflows/publish.yml | 86 ++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 .gitea/workflows/publish.yml diff --git a/.gitea/workflows/publish.yml b/.gitea/workflows/publish.yml new file mode 100644 index 00000000..847c3fc9 --- /dev/null +++ b/.gitea/workflows/publish.yml @@ -0,0 +1,86 @@ +name: Balout-backend-publish + +on: + push: + tags: + - '*' # run on any tag push + +jobs: + build: + name: Run Publish Job + runs-on: ubuntu-latest + + permissions: + contents: read + security-events: write + actions: read + packages: write + id-token: write + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v2.10.0 + + - name: Log into registry git.meshkee.com + uses: docker/login-action@v2.2.0 + with: + registry: git.meshkee.com + username: ${{ vars.DOCKER_USERNAME }} + password: ${{ vars.DOCKER_PASSWORD }} + + - name: Build and push Docker image + id: build-and-push + uses: docker/build-push-action@v4.2.1 + with: + context: . + push: true + tags: | + git.meshkee.com/${{ gitea.repository }}:${{ gitea.ref_name }} + git.meshkee.com/${{ gitea.repository }}:latest + cache-from: type=registry,ref=git.meshkee.com/${{ gitea.repository }}:buildcache + cache-to: type=registry,ref=git.meshkee.com/${{ gitea.repository }}:buildcache,mode=max + # cache-from: type=local,src=/tmp/.buildx-cache + # cache-to: type=local,dest=/tmp/.buildx-cache + secrets: | + gitea_token=${{ secrets.TOKEN }} + + + +# deploy: +# name: Deploy Job +# runs-on: ubuntu-latest + +# permissions: +# contents: read +# security-events: write +# actions: read +# id-token: write + +# steps: +# - name: Deploy to server +# uses: appleboy/ssh-action@v1.0.0 +# with: +# host: ${{ secrets.SSH_HOST }} +# username: ${{ secrets.SSH_USER }} +# key: ${{ secrets.SSH_KEY }} +# port: 22 +# script: | +# cd /apps/balout-backend +# docker pull git.meshkee.com/${{ gitea.repository }}:${{ gitea.ref_name }} +# IMAGE=git.meshkee.com/${{ gitea.repository }}:${{ gitea.ref_name }} docker compose run --rm balout-backend php artisan migrate --pretend --force +# # docker run --rm git.meshkee.com/${{ gitea.repository }}:${{ gitea.ref_name }} php artisan migrate --pretend --force +# if [ $? -eq 0 ]; then +# echo "Migration check passed. Deploying..." +# IMAGE=git.meshkee.com/${{ gitea.repository }}:${{ gitea.ref_name }} docker compose up -d + +# # اجرای واقعی migration داخل کانتینر در حال اجرا +# docker exec balout-backend php artisan migrate --force +# else +# echo "Migration test failed, aborting deploy" +# exit 1 +# fi + +