Skip to content

Commit dd28a7f

Browse files
Merge pull request #109 from Githubguy132010/dev
Add package tracking script and enhance build workflow for version management
2 parents 9f21f37 + 4696f1d commit dd28a7f

File tree

3 files changed

+187
-9
lines changed

3 files changed

+187
-9
lines changed

.github/workflows/build.yaml

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ jobs:
3939
echo "DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
4040
echo "VERSION=$(date +'%Y.%m.%d')" >> $GITHUB_ENV
4141
42-
43-
4442
- name: Set up Arch Linux Container
4543
run: |
4644
docker run --privileged --name arch-container -d \
@@ -74,6 +72,21 @@ jobs:
7472
}
7573
"
7674
75+
- name: Download previous package versions
76+
if: github.ref == 'refs/heads/main'
77+
continue-on-error: true
78+
run: |
79+
mkdir -p /tmp/package-versions
80+
# Try to download the package versions file from the previous release
81+
if ! gh release download --pattern "package_versions.txt" --dir "/tmp/package-versions" 2>/dev/null; then
82+
echo "No previous package_versions.txt found, will create new one."
83+
else
84+
echo "Downloaded previous package versions file."
85+
mv /tmp/package-versions/package_versions.txt /tmp/package-versions/previous_versions.txt
86+
fi
87+
env:
88+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
7790
- name: Build ISO
7891
id: build
7992
run: |
@@ -106,6 +119,23 @@ jobs:
106119
}
107120
"
108121
122+
- name: Generate Package Updates
123+
id: package_updates
124+
run: |
125+
docker exec arch-container bash -c "
126+
set -euo pipefail
127+
cd /workdir
128+
129+
# Make package tracking script executable
130+
chmod +x scripts/package_tracking/track_package_updates.sh
131+
132+
# Run the package tracking script
133+
./scripts/package_tracking/track_package_updates.sh
134+
135+
# Copy current version file for next build
136+
cp /tmp/package-versions/current_versions.txt /workdir/out/package_versions.txt
137+
"
138+
109139
- name: Generate Checksums
110140
run: |
111141
docker exec arch-container bash -c "
@@ -153,6 +183,12 @@ jobs:
153183
-F previous_tag_name="$(git describe --tags --abbrev=0 2>/dev/null || echo '')" \
154184
| jq -r '.body' >> $TEMP_RELEASE_NOTES
155185
186+
# Include package updates in release notes if they exist
187+
if [ -f "/tmp/package-versions/package_updates.md" ]; then
188+
echo "" >> $TEMP_RELEASE_NOTES
189+
cat "/tmp/package-versions/package_updates.md" >> $TEMP_RELEASE_NOTES
190+
fi
191+
156192
# Add standard information
157193
{
158194
echo ""
@@ -189,6 +225,7 @@ jobs:
189225
files: |
190226
${{ env.WORKSPACE }}/out/*.iso
191227
${{ env.WORKSPACE }}/out/*.sha*sum
228+
${{ env.WORKSPACE }}/out/package_versions.txt
192229
193230

194231
- name: Set up GitHub CLI

scripts/entrypoint.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,12 @@ EOF
8383
export JOBS=$(nproc)
8484
log "Using $JOBS processors for parallel compression"
8585

86-
# Run mkarchiso with optimized parameters
87-
log "Building Arch ISO with mkarchiso..."
88-
MKARCHISO_OPTS="-v"
89-
if [ "$JOBS" -gt 1 ]; then
90-
MKARCHISO_OPTS+=" -C xz:threads=$JOBS"
91-
fi
86+
# Note: We don't modify profiledef.sh anymore as -Xthreads is not supported by mksquashfs
87+
# The profiledef.sh file already has proper XZ compression settings
9288

93-
mkarchiso $MKARCHISO_OPTS -w "$work_dir" -o "$output_dir" .
89+
# Run mkarchiso with verbose option only
90+
log "Building Arch ISO with mkarchiso..."
91+
mkarchiso -v -w "$work_dir" -o "$output_dir" .
9492

9593
# Check if build was successful
9694
if [ $? -eq 0 ]; then
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Script to track package updates for release notes
4+
# This script compares current package versions with previous versions and generates a report
5+
6+
set -e
7+
8+
# Colors for better output
9+
GREEN='\033[0;32m'
10+
YELLOW='\033[0;33m'
11+
BLUE='\033[0;34m'
12+
NC='\033[0m' # No Color
13+
14+
log() {
15+
echo -e "${GREEN}[INFO]${NC} $1"
16+
}
17+
18+
warn() {
19+
echo -e "${YELLOW}[WARN]${NC} $1"
20+
}
21+
22+
info() {
23+
echo -e "${BLUE}[INFO]${NC} $1"
24+
}
25+
26+
# Directory for storing package version data
27+
DATA_DIR="/tmp/package-versions"
28+
CURRENT_VERSIONS_FILE="${DATA_DIR}/current_versions.txt"
29+
PREVIOUS_VERSIONS_FILE="${DATA_DIR}/previous_versions.txt"
30+
UPDATES_FILE="${DATA_DIR}/package_updates.md"
31+
32+
# Create data directory if it doesn't exist
33+
mkdir -p "${DATA_DIR}"
34+
35+
# Function to get current package versions
36+
get_current_versions() {
37+
log "Getting current package versions..."
38+
39+
# Make sure we're using an updated database
40+
pacman -Sy --noconfirm > /dev/null 2>&1
41+
42+
# Get package list from packages.x86_64
43+
if [ -f "packages.x86_64" ]; then
44+
while read -r pkg; do
45+
# Skip empty lines and comments
46+
[[ -z "$pkg" || "$pkg" =~ ^# ]] && continue
47+
48+
# Get version information for each package
49+
version=$(pacman -Si "$pkg" 2>/dev/null | grep "Version" | head -n 1 | awk '{print $3}')
50+
51+
if [ -n "$version" ]; then
52+
echo "$pkg=$version" >> "${CURRENT_VERSIONS_FILE}.tmp"
53+
else
54+
warn "Could not get version for package: $pkg"
55+
fi
56+
done < "packages.x86_64"
57+
58+
# Sort the file for easier comparison
59+
sort "${CURRENT_VERSIONS_FILE}.tmp" > "${CURRENT_VERSIONS_FILE}"
60+
rm "${CURRENT_VERSIONS_FILE}.tmp"
61+
else
62+
warn "packages.x86_64 file not found!"
63+
return 1
64+
fi
65+
66+
log "Current package versions saved to ${CURRENT_VERSIONS_FILE}"
67+
}
68+
69+
# Function to save current versions as the new previous versions
70+
save_versions_as_previous() {
71+
if [ -f "${CURRENT_VERSIONS_FILE}" ]; then
72+
cp "${CURRENT_VERSIONS_FILE}" "${PREVIOUS_VERSIONS_FILE}"
73+
log "Saved current versions as previous for next comparison."
74+
else
75+
warn "No current versions file found to save as previous."
76+
fi
77+
}
78+
79+
# Function to compare current with previous versions
80+
compare_versions() {
81+
log "Comparing current package versions with previous versions..."
82+
83+
# If previous versions file doesn't exist, create an empty one
84+
if [ ! -f "${PREVIOUS_VERSIONS_FILE}" ]; then
85+
warn "No previous versions file found. This might be the first run."
86+
touch "${PREVIOUS_VERSIONS_FILE}"
87+
fi
88+
89+
# Create updates file with header
90+
echo "## 📦 Package Updates" > "${UPDATES_FILE}"
91+
echo "" >> "${UPDATES_FILE}"
92+
93+
# Track if we found any updates
94+
found_updates=false
95+
96+
while IFS='=' read -r pkg current_version; do
97+
# Get previous version of this package
98+
previous_version=$(grep "^${pkg}=" "${PREVIOUS_VERSIONS_FILE}" | cut -d'=' -f2)
99+
100+
# If package is new or has a different version
101+
if [ -z "$previous_version" ]; then
102+
echo "- ➕ New package: **${pkg}** (${current_version})" >> "${UPDATES_FILE}"
103+
found_updates=true
104+
elif [ "$previous_version" != "$current_version" ]; then
105+
echo "- 🔄 Updated: **${pkg}** (${previous_version}${current_version})" >> "${UPDATES_FILE}"
106+
found_updates=true
107+
fi
108+
done < "${CURRENT_VERSIONS_FILE}"
109+
110+
# Check for packages that were removed
111+
while IFS='=' read -r pkg previous_version; do
112+
if ! grep -q "^${pkg}=" "${CURRENT_VERSIONS_FILE}"; then
113+
echo "- ❌ Removed: **${pkg}** (was ${previous_version})" >> "${UPDATES_FILE}"
114+
found_updates=true
115+
fi
116+
done < "${PREVIOUS_VERSIONS_FILE}"
117+
118+
# If no updates were found, add a note
119+
if [ "$found_updates" = false ]; then
120+
echo "No package updates since the previous release." >> "${UPDATES_FILE}"
121+
fi
122+
123+
log "Package comparison complete. Results written to ${UPDATES_FILE}"
124+
}
125+
126+
# Main function
127+
main() {
128+
log "Starting package tracking process..."
129+
130+
# Get current versions
131+
get_current_versions
132+
133+
# Compare with previous versions
134+
compare_versions
135+
136+
# After successful comparison, save current as previous for next run
137+
save_versions_as_previous
138+
139+
log "Package tracking completed."
140+
}
141+
142+
# Run the main function
143+
main

0 commit comments

Comments
 (0)