44 lines
1.6 KiB
YAML
44 lines
1.6 KiB
YAML
name: Generate Checksums
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
jobs:
|
|
checksums:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
ref: ${{ github.ref_name }}
|
|
persist-credentials: true
|
|
lfs: false
|
|
- name: Setup Git LFS
|
|
run: |
|
|
git lfs install --local
|
|
AUTH=$(git config http.${{ github.server_url }}/.extraheader)
|
|
AUTH_FILE=$(git config includeif.gitdir:/workspace/${{ github.repository }}/.git.path)
|
|
git config -f $AUTH_FILE --unset http.${{ github.server_url }}/.extraheader
|
|
git config -f $AUTH_FILE http.${{ github.server_url }}/${{ github.repository }}.git/info/lfs/objects/batch.extraheader "$AUTH"
|
|
git lfs pull
|
|
- name: Generate checksums
|
|
run: |
|
|
set -e
|
|
IFS=$'\n'
|
|
for file in $(git ls-files | grep -v ".sha256$" | grep -v ".txt$" | grep -v "^.github/"); do
|
|
filename=$(basename "$file");
|
|
sha256sum -b "$file" | sed "s|$file|$filename|" > "${file}.sha256";
|
|
done
|
|
unset IFS
|
|
echo "ok"
|
|
- name: Commit changes
|
|
run: |
|
|
SERVER_URL=$(echo "${{ github.server_url }}" | sed 's|https\?://||')
|
|
git remote set-url origin https://oauth2:${{ secrets.GITHUB_TOKEN }}@${SERVER_URL}/${{ github.repository }}.git
|
|
git config --global user.name "gitea-actions"
|
|
git config --global user.email "teabot@gitea.io"
|
|
git add -A
|
|
git commit -m "chore: update checksums" || true
|
|
git push origin HEAD:${{ github.ref_name }}
|