mirror of
https://github.com/UberGuidoZ/Flipper.git
synced 2025-06-21 07:34:47 +00:00
Compare commits
4 Commits
5572b35914
...
6fe81b7c5e
Author | SHA1 | Date | |
---|---|---|---|
|
6fe81b7c5e | ||
|
7f94151934 | ||
|
f9865e9c10 | ||
|
9e1029519a |
69
.github/workflows/Snapshot.yml
vendored
Normal file
69
.github/workflows/Snapshot.yml
vendored
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
name: Monthly Snapshot
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 1 * *' # Runs at 00:00 UTC on the 1st of every month
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
snapshot:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo with submodules
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Set date variables
|
||||||
|
id: date
|
||||||
|
run: echo "date=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Install zstd/rsync
|
||||||
|
run: sudo apt-get update && sudo apt-get install -y zstd rsync
|
||||||
|
|
||||||
|
- name: Create a temporary directory for snapshot
|
||||||
|
run: |
|
||||||
|
mkdir -p /tmp/snapshot
|
||||||
|
rsync -av --exclude='.git' --exclude='.gitmodules' --exclude='.github' ./ /tmp/snapshot/
|
||||||
|
rm -rf *
|
||||||
|
|
||||||
|
- name: Create tar.zst snapshot
|
||||||
|
run: |
|
||||||
|
cd /tmp/snapshot
|
||||||
|
tar -I 'zstd -T0 -19' -cvf "$GITHUB_WORKSPACE/Flipper-${{ steps.date.outputs.date }}.tar.zst" *
|
||||||
|
|
||||||
|
- name: Upload snapshot artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: snapshot
|
||||||
|
path: Flipper-${{ steps.date.outputs.date }}.tar.zst
|
||||||
|
|
||||||
|
- name: Check if archive > 2GB and split if needed
|
||||||
|
id: check_size
|
||||||
|
run: |
|
||||||
|
file="Flipper-${{ steps.date.outputs.date }}.tar.zst"
|
||||||
|
max_size=$((2 * 1024 * 1024 * 1024)) # 2GB in bytes
|
||||||
|
actual_size=$(stat -c%s "$file")
|
||||||
|
if [ "$actual_size" -ge "$max_size" ]; then
|
||||||
|
split -b 1996M "$file" "${file}."
|
||||||
|
echo "split=true" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo "split=false" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Create GitHub Release
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
name: "Snapshot ${{ steps.date.outputs.date }}"
|
||||||
|
tag_name: "Snapshot-${{ steps.date.outputs.date }}"
|
||||||
|
body: |
|
||||||
|
Automated snapshot for ${{ steps.date.outputs.date }}.
|
||||||
|
Note: If archive was split due to size >2GB use cat to join them together
|
||||||
|
```
|
||||||
|
cat Flipper-${{ steps.date.outputs.date }}.tar.zst.* > Flipper-${{ steps.date.outputs.date }}.tar.zst
|
||||||
|
```
|
||||||
|
files: |
|
||||||
|
${{ steps.check_size.outputs.split == 'true' && format('Flipper-{0}.tar.zst.*', steps.date.outputs.date) || format('Flipper-{0}.tar.zst', steps.date.outputs.date) }}
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
Loading…
x
Reference in New Issue
Block a user