-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (54 loc) · 1.97 KB
/
check-kernel-releases.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
56
57
58
59
60
name: Check remote DTK tags
on:
# schedule:
# - cron: '*/5 * * * *'
# workflow_dispatch: # Allow manual trigger
[push]
jobs:
check-and-update-dtk-tags:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up skopeo
run: |
sudo apt-get update
sudo apt-get install -y skopeo
- name: Fetch remote DTK kernel version tags
id: fetch-tags
run: |
DTKREPO="quay.io/build-and-sign/pa-driver-toolkit"
TAGS=$(skopeo list-tags docker://$DTKREPO | jq -c '.Tags | sort')
echo "::set-output name=tags::$TAGS"
- name: Compare and update local DTK tags if remote changed
id: compare
run: |
FILE="kernel-versions.json"
RAW_TAGS='${{ steps.fetch-tags.outputs.tags }}'
NEW_TAGS=$(echo "$RAW_TAGS" | jq -c '.')
NEW_TAGS_JSON=$(jq -n \
--argjson kernel_versions "${{ steps.fetch-tags.outputs.tags }}" \
--arg date "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
'{kernel_versions: $kernel_versions, last_updated: $date}')
if [ -f "$FILE" ]; then
OLD_TAGS=$(cat "$FILE" | jq -c '.kernel_versions | sort')
else
OLD_TAGS="[]"
fi
NEW_TAGS=$(echo "$NEW_TAGS_JSON" | jq -c '.kernel_versions | sort')
if [ "$NEW_TAGS" != "$OLD_TAGS" ]; then
echo "New kernel versions found."
echo "$NEW_TAGS_JSON" > "$FILE"
echo "CHANGED=true" >> $GITHUB_ENV
else
echo "No new kernel versions found."
echo "CHANGED=false" >> $GITHUB_ENV
fi
- name: Commit and push changes for new found kernel versions
if: env.CHANGED == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add kernel-versions.json
git commit -m "Update available DTK Kernel versions tags"
git push