Skip to content

Backup Image To PDF repo #61

Backup Image To PDF repo

Backup Image To PDF repo #61

# This is a basic workflow to help you get started with Actions
name: Backup Image To PDF repo
# Controls when the workflow will run
on:
schedule:
# Run every 4 hours
- cron: "0 */4 * * *"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
sync-image-to-pdf-repo:
# The type of runner that the job will run on
runs-on: ubuntu-latest
env:
BACKUP_REPO: [email protected]:mobiledevpro/image-to-pdf-android.git
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Create a directory for Image-To-PDF-repo
run: |
mkdir image-to-pdf-repo
- name: Clone Image-To-PDF Repository
uses: actions/checkout@v4
with:
repository: 'yojimbo45/Image-to-PDF-Android'
path: image-to-pdf-repo
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Check the directory
run: |
cd image-to-pdf-repo && ls
- name: Delete all branches except master
run: |
cd image-to-pdf-repo &&
git ls-remote --heads ${BACKUP_REPO} | awk -F/ '! /\/master/{print $3}' | xargs -I {} git push ${BACKUP_REPO} --delete --force {} || true
- name: Push all branches to backup repo
run: |
cd image-to-pdf-repo && ls &&
git push --force --all ${BACKUP_REPO}
- name: Push all tags to backup repo
run: |
cd image-to-pdf-repo &&
git push --tags