Skip to content

Commit a896d9a

Browse files
committed
Add push to calrepo task
1 parent 1340d9c commit a896d9a

File tree

1 file changed

+27
-37
lines changed

1 file changed

+27
-37
lines changed

.github/workflows/main.yml

Lines changed: 27 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,13 @@ jobs:
2323
echo "pkgName=$pkgName" >> $GITHUB_ENV
2424
inAur=$(echo "${{ matrix.pkgInfo }}" | cut -d$'|' -f2)
2525
echo "inAur=$inAur" >> $GITHUB_ENV
26-
27-
- uses: actions/checkout@v2
28-
with:
29-
fetch-depth: 2
30-
31-
# - uses: actions/checkout@v2
32-
# with:
33-
# fetch-depth: 2
34-
# repository: santilococo/calrepo
35-
# token: ${{ secrets.GH_PAT }}
36-
# path: calrepo
37-
26+
3827
- name: Check modified files
3928
run: |
4029
git diff --name-only HEAD HEAD^ | cut -d$'/' -f1 | grep -q "^${{ env.pkgName }}$" || echo "cancelJob=true" >> $GITHUB_ENV
4130
msg="Update" && [ -f "${{ env.pkgName }}/.SRCINFO" ] || msg="Add"
4231
echo "msg=$msg" >> $GITHUB_ENV
43-
32+
4433
- name: Build package and output .SRCINFO
4534
if: ${{ env.cancelJob == 'false' }}
4635
uses: santilococo/calbuilder@master
@@ -49,29 +38,30 @@ jobs:
4938
gpgPublicKey: "C03E1F00B0461E7F"
5039
gpgPrivateKey: "${{ secrets.GPG_PRIVATE_KEY }}"
5140
gpgPassphrase: "${{ secrets.GPG_PASSPHRASE }}"
52-
53-
# - name: Push to calrepo
54-
# if: ${{ env.cancelJob == 'false' && env.inAur == 'N' }}
55-
# run: |
56-
# pkgFileName=$(ls *.pkg.tar.zst)
57-
# arch="$(grep -oP '(?<=arch=\(.).*?(?=.\))' "${{ env.pkgName }}/PKGBUILD")"
58-
# findOutput=$(find -H "calrepo/$arch" -regex ".*${{ env.pkgName }}.*" | wc -l)
59-
# [ $findOutput -eq 0 ] && msg="Add" || msg="Update"
60-
# while read -r -d '' file; do
61-
# rm -f "$file"
62-
# done < <(find -H "calrepo/$arch" -regex ".*${{ env.pkgName }}.*" -print0)
63-
# mv "$pkgFileName"* calrepo/$arch
64-
# cd calrepo
65-
# git config --local user.name "$(git log --format=%an | head -n 1)"
66-
# git config --local user.email "$(git log --format=%ae | head -n 1)"
67-
# gitStatus="$(git status --porcelain)"
68-
# if [ ! -z "$gitStatus" ]; then
69-
# git pull
70-
# git add .
71-
# git commit -m "$msg ${{ env.pkgName }}"
72-
# git push
73-
# fi
74-
41+
42+
- name: Push to calrepo
43+
if: ${{ env.cancelJob == 'false' && env.inAur == 'N' }}
44+
run: |
45+
pkgFileName=$(ls *.pkg.tar.zst)
46+
arch="$(grep -oP '(?<=arch=\(.).*?(?=.\))' "${{ env.pkgName }}/PKGBUILD")"
47+
findOutput=$(find -H "calrepo/$arch" -regex ".*${{ env.pkgName }}.*" | wc -l)
48+
[ $findOutput -eq 0 ] && msg="Add" || msg="Update"
49+
while read -r -d '' file; do
50+
rm -f "$file"
51+
done < <(find -H "calrepo/$arch" -regex ".*${{ env.pkgName }}.*" -print0)
52+
mv "$pkgFileName"* calrepo/$arch
53+
git clone "https://git-ssh-token:${{ secret.GIT_TOKEN }}@git.slc.ar/slococo/calrepo.git"
54+
cd calrepo
55+
git config --local user.name "$(git log --format=%an | head -n 1)"
56+
git config --local user.email "$(git log --format=%ae | head -n 1)"
57+
gitStatus="$(git status --porcelain)"
58+
if [ ! -z "$gitStatus" ]; then
59+
git pull
60+
git add .
61+
git commit -m "$msg ${{ env.pkgName }}"
62+
git push
63+
fi
64+
7565
- name: Push .SRCINFO
7666
if: ${{ env.cancelJob == 'false' }}
7767
run: |
@@ -92,7 +82,7 @@ jobs:
9282
fi
9383
git push
9484
fi
95-
85+
9686
- name: Push to AUR
9787
if: ${{ env.cancelJob == 'false' && env.inAur == 'Y' }}
9888
run: |

0 commit comments

Comments
 (0)