Skip to content

Commit be1639f

Browse files
authored
Use Git LFS
1 parent c3b8692 commit be1639f

1 file changed

Lines changed: 8 additions & 22 deletions

File tree

‎.github/workflows/archive.yml‎

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Archive website (pax + gzip + signify)
22

33
on:
44
schedule:
5-
- cron: '0 0 * * *' # Once per day at 00:00 UTC
5+
- cron: '0 0 * * *'
66
workflow_dispatch:
77

88
permissions:
@@ -19,6 +19,11 @@ jobs:
1919
steps:
2020
- name: Checkout repository
2121
uses: actions/checkout@v4
22+
with:
23+
lfs: true
24+
25+
- name: Initialize Git LFS
26+
run: git lfs install
2227

2328
- name: Install dependencies
2429
run: |
@@ -28,57 +33,38 @@ jobs:
2833
- name: Create Archive, Checksum, and Signature
2934
run: |
3035
set -e
31-
32-
echo "Running on:"
33-
uname -a
34-
3536
REPO_NAME=$(basename "$GITHUB_REPOSITORY")
3637
ARCHIVE_DIR="$GITHUB_WORKSPACE/archive"
3738
TMP_DIR="$GITHUB_WORKSPACE/tmp_archive"
3839
39-
mkdir -p "$ARCHIVE_DIR"
40-
mkdir -p "$TMP_DIR"
40+
mkdir -p "$ARCHIVE_DIR" "$TMP_DIR"
4141
4242
ARCHIVE="$TMP_DIR/$REPO_NAME.tar.gz"
4343
CHECKSUM="$TMP_DIR/$REPO_NAME.tar.gz.sha256"
4444
SIGNATURE="$TMP_DIR/$REPO_NAME.tar.gz.sig"
4545
46-
# Remove old files if they exist
4746
rm -f "$ARCHIVE" "$CHECKSUM" "$SIGNATURE"
4847
49-
# Create tar.gz archive in PAX format, excluding temporary directory
5048
tar --format=pax --exclude="tmp_archive" -czf "$ARCHIVE" .
51-
52-
# Generate SHA256 checksum in proper format for sha256sum -c
5349
sha256sum "$ARCHIVE" > "$CHECKSUM"
5450
55-
# Write SIGNIFY_KEY secret to a temporary file (never added to repo)
5651
printf "%s\n" "$SIGNIFY_KEY" > "$TMP_DIR/archive.sec"
5752
chmod 600 "$TMP_DIR/archive.sec"
5853
59-
# Sign the archive
6054
signify-openbsd -S -s "$TMP_DIR/archive.sec" -m "$ARCHIVE"
6155
62-
# Copy only the archive, checksum, and signature to the repo's archive directory
63-
cp "$ARCHIVE" "$ARCHIVE_DIR/"
64-
cp "$CHECKSUM" "$ARCHIVE_DIR/"
65-
cp "$SIGNATURE" "$ARCHIVE_DIR/"
56+
cp "$ARCHIVE" "$CHECKSUM" "$SIGNATURE" "$ARCHIVE_DIR/"
6657
6758
- name: Commit and Push Changes via GitHub CLI
6859
run: |
6960
set -e
70-
71-
# Setup git to use GitHub CLI credentials
7261
gh auth setup-git
7362
git config user.name "github-actions[bot]"
7463
git config user.email "github-actions[bot]@users.noreply.github.com"
7564
76-
# Commit changes only if there are any
77-
cd "$GITHUB_WORKSPACE"
7865
if [ -n "$(git status --porcelain)" ]; then
7966
git add archive/
8067
git commit -m "Archive website"
81-
# Detect default branch and push
8268
BRANCH=$(gh repo view --json defaultBranchRef -q '.defaultBranchRef.name')
8369
git push origin "$BRANCH"
8470
else

0 commit comments

Comments
 (0)