Skip to content

Backup Image To PDF repo #291

Backup Image To PDF repo

Backup Image To PDF repo #291

# 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:
# At 00:00 every day
- cron: "0 0 * * *"
# 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:
ORIGIN_REPO: [email protected]:yojimbo45/Image-to-PDF-Android.git
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:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# - uses: actions/checkout@v4
# Checkout the repo https://github.com/yojimbo45/Image-to-PDF-Android
- name: Checkout Image-To-PDF-repo
uses: actions/checkout@v4
with:
url: ${{ env.ORIGIN_REPO }}
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
ref: main
fetch-depth: 0
- name: Swith remote origin
run: |
git remote set-url origin ${BACKUP_REPO}
- name: Delete all branches except master
run: |
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: |
git push --force main:master
- name: Push all tags to backup repo
run: |
git push --tags