Testing backup workflow
Some checks failed
Git Backup to WebDAV / print-content (push) Failing after 5s
Some checks failed
Git Backup to WebDAV / print-content (push) Failing after 5s
This commit is contained in:
parent
d3fc44f582
commit
bf14b039d4
1 changed files with 12 additions and 8 deletions
|
|
@ -10,25 +10,29 @@ jobs:
|
|||
steps:
|
||||
- name: checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: archive repository
|
||||
run: |
|
||||
# 1. Extract Info
|
||||
PROJECT_NAME=$(echo "${{ github.repository }}" | cut -d'/' -f2)
|
||||
# Replace slashes in branch names (e.g., feature/login -> feature-login)
|
||||
BRANCH_NAME=$(echo "${{ github.ref_name }}" | sed 's/\//-/g')
|
||||
TIMESTAMP=$(date +'%Y-%m-%d_%H-%M')
|
||||
|
||||
FILENAME="${PROJECT_NAME}_${BRANCH_NAME}_${TIMESTAMP}.tar.gz"
|
||||
# Create the local variable
|
||||
FINAL_NAME="${PROJECT_NAME}_${BRANCH_NAME}_${TIMESTAMP}.tar.gz"
|
||||
|
||||
echo "Creating archive: $FILENAME"
|
||||
# CRITICAL: Save it for the next step
|
||||
echo "FILENAME=$FINAL_NAME" >> $GITHUB_ENV
|
||||
|
||||
# 2. Use git archive to create the tar.gz
|
||||
# 'HEAD' refers to the current commit the runner just pulled
|
||||
git archive --format=tar.gz -v -o "$FILENAME" HEAD
|
||||
# Create the archive
|
||||
git archive --format=tar.gz -o "$FINAL_NAME" HEAD
|
||||
echo "Archive created: $FINAL_NAME"
|
||||
|
||||
- name: Upload via Curl
|
||||
run: |
|
||||
curl -T "$FILENAME" \
|
||||
ls -lh "$FILENAME"
|
||||
|
||||
curl -T -v "$FILENAME" \
|
||||
-u "${{ secrets.WEBDAV_USER }}:${{ secrets.WEBDAV_PASSWORD }}" \
|
||||
"${{ secrets.WEBDAV_URL }}/Backups/GIT/$PROJECT_NAME/$FILENAME"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue