-
Notifications
You must be signed in to change notification settings - Fork 5
42 lines (42 loc) · 1.35 KB
/
update-images.yml
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
name: Update Images
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * MON'
permissions: write-all
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Run update-images.py
run: |
scripts/update-images.py
for distro in ubuntu debian; do
cat "$distro".json | jq -S > "$distro"/images.json
rm "$distro".json
done
if [[ -z $(git status -s) ]]; then
echo "Images up to date"
exit 0
else
echo "New image"
git diff
git config user.name github-actions
git config user.email [email protected]
branchname="update-images-$(date +%F)"
git checkout -b "${branchname}"
git add debian/images.json
git add ubuntu/images.json
git commit -m "Update images: $(date +%F)"
git push origin "${branchname}"
gh pr create -B main -H "${branchname}" \
--title 'Bump images.json' \
--body 'PR generated using scripts/update-images.py'
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}