Skip to content

Commit 66ad981

Browse files
committed
Package version checks and missing base system for iwd
1 parent 052ae6c commit 66ad981

3 files changed

Lines changed: 203 additions & 295 deletions

File tree

Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
name: Check Package Versions
2+
3+
on:
4+
schedule:
5+
- cron: '0 6 * * *' # Daily at 6 AM UTC
6+
workflow_dispatch:
7+
inputs:
8+
package:
9+
description: 'Specific package to check (leave empty for all)'
10+
required: false
11+
type: string
12+
13+
permissions:
14+
contents: write
15+
pull-requests: write
16+
17+
jobs:
18+
check-versions:
19+
runs-on: ubuntu-latest
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
# Hyprland ecosystem
25+
- package: hyprutils
26+
repo: hyprwm/hyprutils
27+
- package: hyprlang
28+
repo: hyprwm/hyprlang
29+
- package: hyprwayland-scanner
30+
repo: hyprwm/hyprwayland-scanner
31+
- package: hyprgraphics
32+
repo: hyprwm/hyprgraphics
33+
- package: hyprcursor
34+
repo: hyprwm/hyprcursor
35+
- package: hyprland-protocols
36+
repo: hyprwm/hyprland-protocols
37+
- package: aquamarine
38+
repo: hyprwm/aquamarine
39+
- package: hyprland-qt-support
40+
repo: hyprwm/hyprland-qt-support
41+
- package: hyprland
42+
repo: hyprwm/Hyprland
43+
- package: hyprlock
44+
repo: hyprwm/hyprlock
45+
- package: hypridle
46+
repo: hyprwm/hypridle
47+
- package: hyprpaper
48+
repo: hyprwm/hyprpaper
49+
- package: xdg-desktop-portal-hyprland
50+
repo: hyprwm/xdg-desktop-portal-hyprland
51+
- package: hyprpolkitagent
52+
repo: hyprwm/hyprpolkitagent
53+
- package: hyprtoolkit
54+
repo: hyprwm/hyprtoolkit
55+
- package: hyprland-guiutils
56+
repo: hyprwm/hyprland-guiutils
57+
# CLI tools
58+
- package: eza
59+
repo: eza-community/eza
60+
- package: starship
61+
repo: starship/starship
62+
- package: lazygit
63+
repo: jesseduffield/lazygit
64+
- package: wifitui
65+
repo: shazow/wifitui
66+
# Other
67+
- package: glaze
68+
repo: stephenberry/glaze
69+
- package: uwsm
70+
repo: Vladimir-csp/uwsm
71+
- package: quickshell
72+
repo: quickshell-mirror/quickshell
73+
- package: regreet
74+
repo: rharish101/ReGreet
75+
# livesys-scripts uses our fork, skip auto-update
76+
# - package: livesys-scripts
77+
# repo: binarypie-dev/livesys-scripts
78+
79+
steps:
80+
- name: Check if should run
81+
id: should-run
82+
run: |
83+
if [ -n "${{ inputs.package }}" ] && [ "${{ inputs.package }}" != "${{ matrix.package }}" ]; then
84+
echo "skip=true" >> $GITHUB_OUTPUT
85+
else
86+
echo "skip=false" >> $GITHUB_OUTPUT
87+
fi
88+
89+
- name: Checkout
90+
if: steps.should-run.outputs.skip != 'true'
91+
uses: actions/checkout@v4
92+
93+
- name: Get upstream version
94+
if: steps.should-run.outputs.skip != 'true'
95+
id: upstream
96+
env:
97+
GH_TOKEN: ${{ github.token }}
98+
run: |
99+
# Get latest release from GitHub
100+
RELEASE=$(gh api repos/${{ matrix.repo }}/releases/latest --jq '.tag_name' 2>/dev/null || echo "")
101+
102+
# If no releases, try tags
103+
if [ -z "$RELEASE" ]; then
104+
RELEASE=$(gh api repos/${{ matrix.repo }}/tags --jq '.[0].name' 2>/dev/null || echo "")
105+
fi
106+
107+
# Strip 'v' prefix if present
108+
VERSION="${RELEASE#v}"
109+
110+
echo "version=$VERSION" >> $GITHUB_OUTPUT
111+
echo "Upstream version: $VERSION"
112+
113+
- name: Get spec version
114+
if: steps.should-run.outputs.skip != 'true'
115+
id: spec
116+
run: |
117+
SPEC_FILE="packages/${{ matrix.package }}/${{ matrix.package }}.spec"
118+
119+
if [ ! -f "$SPEC_FILE" ]; then
120+
echo "Spec file not found: $SPEC_FILE"
121+
echo "version=" >> $GITHUB_OUTPUT
122+
exit 0
123+
fi
124+
125+
# Extract version from spec file
126+
VERSION=$(grep "^Version:" "$SPEC_FILE" | awk '{print $2}')
127+
128+
echo "version=$VERSION" >> $GITHUB_OUTPUT
129+
echo "Spec version: $VERSION"
130+
131+
- name: Compare versions
132+
if: steps.should-run.outputs.skip != 'true'
133+
id: compare
134+
run: |
135+
UPSTREAM="${{ steps.upstream.outputs.version }}"
136+
SPEC="${{ steps.spec.outputs.version }}"
137+
138+
if [ -z "$UPSTREAM" ]; then
139+
echo "Could not determine upstream version"
140+
echo "needs_update=false" >> $GITHUB_OUTPUT
141+
exit 0
142+
fi
143+
144+
if [ -z "$SPEC" ]; then
145+
echo "Could not determine spec version"
146+
echo "needs_update=false" >> $GITHUB_OUTPUT
147+
exit 0
148+
fi
149+
150+
if [ "$UPSTREAM" != "$SPEC" ]; then
151+
echo "Version mismatch: upstream=$UPSTREAM, spec=$SPEC"
152+
echo "needs_update=true" >> $GITHUB_OUTPUT
153+
else
154+
echo "Versions match: $SPEC"
155+
echo "needs_update=false" >> $GITHUB_OUTPUT
156+
fi
157+
158+
- name: Update spec file
159+
if: steps.should-run.outputs.skip != 'true' && steps.compare.outputs.needs_update == 'true'
160+
run: |
161+
SPEC_FILE="packages/${{ matrix.package }}/${{ matrix.package }}.spec"
162+
OLD_VERSION="${{ steps.spec.outputs.version }}"
163+
NEW_VERSION="${{ steps.upstream.outputs.version }}"
164+
165+
# Update Version field
166+
sed -i "s/^Version:.*$/Version: $NEW_VERSION/" "$SPEC_FILE"
167+
168+
# Update Release back to 1 for new version
169+
sed -i "s/^Release:.*$/Release: 1%{?dist}/" "$SPEC_FILE"
170+
171+
# Update changelog with new entry
172+
DATE=$(date "+%a %b %d %Y")
173+
CHANGELOG_ENTRY="* $DATE Hypercube <hypercube@binarypie.dev> - $NEW_VERSION-1\n- Update to $NEW_VERSION"
174+
175+
# Insert new changelog entry after %changelog line
176+
sed -i "/%changelog/a\\$CHANGELOG_ENTRY" "$SPEC_FILE"
177+
178+
echo "Updated ${{ matrix.package }} from $OLD_VERSION to $NEW_VERSION"
179+
180+
- name: Create Pull Request
181+
if: steps.should-run.outputs.skip != 'true' && steps.compare.outputs.needs_update == 'true'
182+
uses: peter-evans/create-pull-request@v7
183+
with:
184+
token: ${{ secrets.GITHUB_TOKEN }}
185+
commit-message: "pkg(${{ matrix.package }}): update to ${{ steps.upstream.outputs.version }}"
186+
title: "pkg(${{ matrix.package }}): update to ${{ steps.upstream.outputs.version }}"
187+
body: |
188+
Updates **${{ matrix.package }}** from `${{ steps.spec.outputs.version }}` to `${{ steps.upstream.outputs.version }}`
189+
190+
**Upstream release:** https://github.com/${{ matrix.repo }}/releases/tag/v${{ steps.upstream.outputs.version }}
191+
192+
---
193+
*This PR was automatically created by the package version checker.*
194+
branch: "pkg-update/${{ matrix.package }}-${{ steps.upstream.outputs.version }}"
195+
delete-branch: true
196+
labels: |
197+
dependencies
198+
package-update

0 commit comments

Comments
 (0)