Update Gitea deployment workflow

This commit is contained in:
SaketAnand 2026-03-06 02:03:33 +05:30
parent 6cb7f88bd5
commit 7baa467cf2

View File

@ -1,11 +1,17 @@
name: Workflow push to Dappbundle name: Deploy to Dappbundle
on: [push]
on:
push:
branches:
- main
jobs: jobs:
build: build:
name: Build name: Deploy
runs-on: self-hosted runs-on: ubuntu-latest
steps: steps:
- name: Executing remote command - name: Deploy via SSH
uses: appleboy/ssh-action@v1.0.0 uses: appleboy/ssh-action@v1.0.0
with: with:
host: ${{ secrets.R_HOST }} host: ${{ secrets.R_HOST }}
@ -13,20 +19,31 @@ jobs:
password: ${{ secrets.P_PASSWORD }} password: ${{ secrets.P_PASSWORD }}
port: ${{ secrets.SSH_PORT }} port: ${{ secrets.SSH_PORT }}
script: | script: |
if [ -d "${{ secrets.DEPLOYMENT_LOCATION}}/dappbundle" ]; then set -e
echo "Folder exists. Skipping Git clone."
BASE="${{ secrets.DEPLOYMENT_LOCATION }}"
APP="${{ github.event.repository.name }}"
echo "== Ensuring dappbundle repo exists =="
if [ ! -d "$BASE/dappbundle/.git" ]; then
echo "Cloning dappbundle..."
git clone git@gitea.ranchimall.net:RanchiMall/dappbundle.git "$BASE/dappbundle"
else else
echo "Folder does not exist. Cloning repository..." echo "Updating dappbundle..."
cd ${{ secrets.DEPLOYMENT_LOCATION}}/ && git clone https://github.com/ranchimall/dappbundle.git cd "$BASE/dappbundle"
git pull
fi fi
if [ -d "${{ secrets.DEPLOYMENT_LOCATION}}/dappbundle/${{ github.event.repository.name }}" ]; then echo "== Refreshing app bundle =="
echo "Repository exists. Remove folder "
rm -r "${{ secrets.DEPLOYMENT_LOCATION}}/dappbundle/${{ github.event.repository.name }}"
fi
echo "Cloning repository..." rm -rf "$BASE/dappbundle/$APP"
cd ${{ secrets.DEPLOYMENT_LOCATION}}/dappbundle && git clone https://github.com/ranchimall/${{ github.event.repository.name }} git clone git@gitea.ranchimall.net:RanchiMall/$APP.git "$BASE/dappbundle/$APP"
cd "${{ secrets.DEPLOYMENT_LOCATION}}/dappbundle/${{ github.event.repository.name }}" && rm -rf .gitattributes .git .github .gitignore cd "$BASE/dappbundle"
cd ${{ secrets.DEPLOYMENT_LOCATION}}/dappbundle/ && git add . && git commit -m "Workflow updating files of ${{ github.event.repository.name }}" && git push "https://ranchimalldev:${{ secrets.RM_ACCESS_TOKEN }}@github.com/ranchimall/dappbundle.git" git config user.email "ranchimallfze@gmail.com"
git config user.name "ranchimall"
git add .
git commit -m "Auto-update $APP" || echo "No changes to commit"
git push