-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (71 loc) · 2.48 KB
/
fetch-aemulo.yml
File metadata and controls
84 lines (71 loc) · 2.48 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Fetch Aemulo Debs
on:
push:
branches: [ main ]
paths:
- '.github/workflows/fetch-aemulo.yml'
workflow_dispatch:
schedule:
- cron: "0 12 * * 0" # weekly check every Sunday at noon UTC
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
jobs:
fetch:
name: Download latest Aemulo debs
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch latest release debs
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Get the latest release tag
RELEASE=$(gh api repos/Aemulo/Release/releases/latest --jq '.tag_name')
echo "Latest Aemulo release: ${RELEASE}"
echo "AEMULO_VERSION=${RELEASE}" >> "$GITHUB_ENV"
# Get all .deb asset download URLs
URLS=$(gh api repos/Aemulo/Release/releases/latest \
--jq '.assets[] | select(.name | endswith(".deb")) | .browser_download_url')
if [ -z "$URLS" ]; then
echo "No .deb assets found in latest release"
exit 1
fi
# Remove old Aemulo debs
rm -f debs/com.amywhile.aemulo_*.deb
# Download each .deb into debs/
echo "$URLS" | while read -r url; do
filename=$(basename "$url")
echo "Downloading ${filename}..."
curl -fSL -o "debs/${filename}" "$url"
done
echo "Downloaded debs:"
ls -la debs/com.amywhile.aemulo_*.deb
- name: Fix Section in deb control files
run: |
for deb in debs/com.amywhile.aemulo_*.deb; do
echo "Patching ${deb}..."
TMPDIR=$(mktemp -d)
dpkg-deb -R "$deb" "$TMPDIR"
sed -i 's/^Section: Tweaks$/Section: Utilities/' "$TMPDIR/DEBIAN/control"
dpkg-deb -b "$TMPDIR" "$deb"
rm -rf "$TMPDIR"
done
- name: Commit new debs
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git add debs/*.deb
# Also stage removals of old debs
git add -u debs/
git diff --cached --quiet && echo "No changes — already up to date" && exit 0
git commit -m "chore: update Aemulo debs to ${AEMULO_VERSION} [ci skip]"
git pull --rebase
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}