From 80c74cd9d947aaef837346cd4e51949dbc3ce705 Mon Sep 17 00:00:00 2001 From: Vivek Teega Date: Mon, 18 Dec 2023 20:12:33 +0530 Subject: [PATCH] Push dappbundle --- .github/workflows/push-dappbundle.yml | 32 +++++++++++++++++++++++++++ .github/workflows/repopush.yml | 18 --------------- 2 files changed, 32 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/push-dappbundle.yml delete mode 100644 .github/workflows/repopush.yml diff --git a/.github/workflows/push-dappbundle.yml b/.github/workflows/push-dappbundle.yml new file mode 100644 index 0000000..0bcc6fc --- /dev/null +++ b/.github/workflows/push-dappbundle.yml @@ -0,0 +1,32 @@ +name: Workflow push to Dappbundle +on: [push] +jobs: + build: + name: Build + runs-on: self-hosted + steps: + - name: Executing remote command + uses: appleboy/ssh-action@v1.0.0 + with: + host: ${{ secrets.R_HOST }} + username: ${{ secrets.P_USERNAME }} + password: ${{ secrets.P_PASSWORD }} + port: ${{ secrets.SSH_PORT }} + script: | + if [ -d "${{ secrets.DEPLOYMENT_LOCATION}}/dappbundle" ]; then + echo "Folder exists. Skipping Git clone." + else + echo "Folder does not exist. Cloning repository..." + cd ${{ secrets.DEPLOYMENT_LOCATION}}/ && git clone https://github.com/ranchimall/dappbundle.git + 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 "Cloning repository..." + cd ${{ secrets.DEPLOYMENT_LOCATION}}/dappbundle && git clone https://github.com/ranchimall/${{ github.event.repository.name }} + + cd "${{ secrets.DEPLOYMENT_LOCATION}}/dappbundle/${{ github.event.repository.name }}" && rm -r .gitattributes + 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" \ No newline at end of file diff --git a/.github/workflows/repopush.yml b/.github/workflows/repopush.yml deleted file mode 100644 index 9cd6ebc..0000000 --- a/.github/workflows/repopush.yml +++ /dev/null @@ -1,18 +0,0 @@ -# push contents of this repo to specified repo on github on commit -name: push this repo to bundle repo -on: [push] -permissions: - contents: write -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: push to bundle repo - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.SM_ACCESS_TOKEN }} - branch: master - force: true - directory: . - repository: ranchimall/dappbundle