-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (47 loc) · 1.72 KB
/
update-index.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Update index
on:
push:
branches:
- main
workflow_dispatch:
env:
FLATPAK_BRANCH: devtest
DESTINATION_GITHUB_USERNAME: grillo-delmal
DESTINATION_REPOSITORY_NAME: inochi2d-flatpak-devtest
jobs:
update-index:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Update static index
env:
REGISTRY_AUTH_FILE: /tmp/auth.json
run: |
export FILES="./repos/*"
git clone -b gh-pages https://github.com/$DESTINATION_GITHUB_USERNAME/$DESTINATION_REPOSITORY_NAME.git ./gh-pages
echo '{"Registry": "https://ghcr.io/","Results": []}' > ./gh-pages/index/static
for f in $FILES ; do
echo "Processing $f file..."
cat ./gh-pages/index/static | jq --argjson container "$(cat $f)" '.Results += [ $container ]' > ./gh-pages/index/static
done
- name: Check for changes
id: is-updated
run: |
set -x
git -C ./gh-pages status -s -uno
cat ./gh-pages/index/static
# Don't let the file be empty
[ ! -s ./gh-pages/index/static ] || [ -z "$(git -C ./gh-pages status -s -uno)" ] || echo "updated=true" >> $GITHUB_OUTPUT
- name: Push to repository
if: steps.is-updated.outputs.updated
uses: cpina/github-action-push-to-another-repository@main
env:
API_TOKEN_GITHUB: ${{ secrets.PAT }}
with:
source-directory: './gh-pages'
destination-github-username: ${{ env.DESTINATION_GITHUB_USERNAME }}
destination-repository-name: ${{ env.DESTINATION_REPOSITORY_NAME }}
user-email: github-actions[bot]@users.noreply.github.com
commit-message: Update index
target-branch: gh-pages