33 lines
1.2 KiB
YAML
33 lines
1.2 KiB
YAML
name: Generate Checksums
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
jobs:
|
|
checksums:
|
|
runs-on: cn
|
|
steps:
|
|
- name: Generate checksums
|
|
run: |
|
|
set -e
|
|
git config --global credential.helper store
|
|
echo "https://ci:${{ secrets.CI_PASSWORD }}@git.haozi.net" > ~/.git-credentials
|
|
git clone --depth 1 ${{ github.server_url }}/${{ github.repository }}.git ${{ github.workspace }}/repo
|
|
cd ${{ github.workspace }}/repo
|
|
git checkout ${{ github.ref_name }}
|
|
git lfs install --local
|
|
git config lfs.${{ github.server_url }}/${{ github.repository }}.git/info/lfs.locksverify true
|
|
git lfs pull
|
|
IFS=$'\n'
|
|
for file in $(git ls-files | grep "^panel/" | grep -v ".sha256$" | grep -v ".txt$"); do
|
|
filename=$(basename "$file");
|
|
sha256sum -b "$file" | sed "s|$file|$filename|" > "${file}.sha256";
|
|
done
|
|
unset IFS
|
|
git add -A
|
|
git config --global user.name "CI"
|
|
git config --global user.email "ci@haozi.net"
|
|
git commit -m "chore: update checksums" || true
|
|
git push origin ${{ github.ref_name }}
|