Update .github/workflows/push-dappbundle.yml
Some checks failed
Deploy to Dappbundle / Deploy (push) Has been cancelled
Some checks failed
Deploy to Dappbundle / Deploy (push) Has been cancelled
This commit is contained in:
parent
a9fa4f3c78
commit
7de196645b
48
.github/workflows/push-dappbundle.yml
vendored
48
.github/workflows/push-dappbundle.yml
vendored
@ -1,11 +1,17 @@
|
||||
name: Workflow push to Dappbundle
|
||||
on: [push]
|
||||
name: Deploy to Dappbundle
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
name: Deploy
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Executing remote command
|
||||
- name: Deploy via SSH
|
||||
uses: appleboy/ssh-action@v1.0.0
|
||||
with:
|
||||
host: ${{ secrets.R_HOST }}
|
||||
@ -13,20 +19,30 @@ jobs:
|
||||
password: ${{ secrets.P_PASSWORD }}
|
||||
port: ${{ secrets.SSH_PORT }}
|
||||
script: |
|
||||
if [ -d "${{ secrets.DEPLOYMENT_LOCATION}}/dappbundle" ]; then
|
||||
echo "Folder exists. Skipping Git clone."
|
||||
set -e
|
||||
|
||||
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 https://gitea.ranchimall.net/RanchiMall/dappbundle.git "$BASE/dappbundle"
|
||||
else
|
||||
echo "Folder does not exist. Cloning repository..."
|
||||
cd ${{ secrets.DEPLOYMENT_LOCATION}}/ && git clone https://github.com/ranchimall/dappbundle.git
|
||||
echo "Updating dappbundle..."
|
||||
cd "$BASE/dappbundle"
|
||||
git pull
|
||||
fi
|
||||
|
||||
if [ -d "${{ secrets.DEPLOYMENT_LOCATION}}/dappbundle/${{ github.event.repository.name }}" ]; then
|
||||
echo "Repository exists. Remove folder "
|
||||
rm -r "${{ secrets.DEPLOYMENT_LOCATION}}/dappbundle/${{ github.event.repository.name }}"
|
||||
fi
|
||||
echo "== Refreshing app bundle =="
|
||||
|
||||
echo "Cloning repository..."
|
||||
cd ${{ secrets.DEPLOYMENT_LOCATION}}/dappbundle && git clone https://github.com/ranchimall/${{ github.event.repository.name }}
|
||||
rm -rf "$BASE/dappbundle/$APP"
|
||||
|
||||
cd "${{ secrets.DEPLOYMENT_LOCATION}}/dappbundle/${{ github.event.repository.name }}" && rm -rf .gitattributes .git .github .gitignore
|
||||
cd ${{ secrets.DEPLOYMENT_LOCATION}}/dappbundle/ && git add . && git commit -m "Workflow updating files of ${{ github.event.repository.name }}" && git push "https://saketongit:${{ secrets.RM_ACCESS_TOKEN }}@github.com/ranchimall/dappbundle.git"
|
||||
git clone https://gitea.ranchimall.net/RanchiMall/$APP "$BASE/dappbundle/$APP"
|
||||
|
||||
cd "$BASE/dappbundle"
|
||||
|
||||
git add .
|
||||
git commit -m "Auto-update $APP" || echo "No changes to commit"
|
||||
git push
|
||||
Loading…
Reference in New Issue
Block a user