Skip to content

Commit

Permalink
Merge pull request #22 from lscambo13/lscambo13-patch-1
Browse files Browse the repository at this point in the history
Create main.yml
  • Loading branch information
lscambo13 authored Jan 31, 2024
2 parents bfeba45 + b3210fc commit 49deece
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Copy folder to other branch

on: [push]

jobs:
copy:
name: Copy my folder
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: copy
env:
SRC_FOLDER_PATH: 'dist'
TARGET_BRANCH: 'dist'
run: |
files=$(find $SRC_FOLDER_PATH -type f) # get the file list
git config --global user.name 'GitHub Action'
git config --global user.email '[email protected]'
git fetch # fetch branches
git checkout $TARGET_BRANCH # checkout to your branch
git checkout ${GITHUB_REF##*/} -- $files # copy files from the source branch
git add -A
git diff-index --quiet HEAD || git commit -am "deploy files" # commit to the repository (ignore if no modification)
git push origin $TARGET_BRANCH # push to remote branch

0 comments on commit 49deece

Please sign in to comment.