Backup Image To PDF repo #283
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic workflow to help you get started with Actions | |
name: Sync Image To PDF repo | |
# Controls when the workflow will run | |
on: | |
schedule: | |
- cron: "* */2 * * *" | |
# 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: | |
# 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: [email protected]:yojimbo45/Image-to-PDF-Android.git | |
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- 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 --all ${BACKUP_REPO} | |
- name: Push all tags to backup repo | |
run: | | |
git push ${BACKUP_REPO} --tags |