-
-
Notifications
You must be signed in to change notification settings - Fork 4
125 lines (101 loc) · 4.09 KB
/
check-lua-updates.yml
File metadata and controls
125 lines (101 loc) · 4.09 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: Check for Lua Updates
on:
schedule:
# Run weekly on Monday at 9:00 UTC to check for new releases
- cron: '0 9 * * 1'
workflow_dispatch: # Allow manual triggers
jobs:
check-updates:
name: Check for new Lua releases
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check for Lua updates
id: check
env:
GH_TOKEN: ${{ github.token }}
run: |
# Function to get current version from existing tarballs
get_current_version() {
local major_minor=$1
ls lua-${major_minor}.*.tar.gz 2>/dev/null | \
grep -oP "${major_minor}\.\d+" | head -1 || echo ""
}
# Check each Lua version
UPDATES_FOUND=false
UPDATE_SUMMARY=""
for version in lua51 lua53 lua54 lua55; do
case $version in
lua51) MAJOR_MINOR="5.1" ;;
lua53) MAJOR_MINOR="5.3" ;;
lua54) MAJOR_MINOR="5.4" ;;
lua55) MAJOR_MINOR="5.5" ;;
esac
CURRENT=$(get_current_version $MAJOR_MINOR)
# Get latest release info from lua.org
LATEST=$(curl -s https://www.lua.org/ftp/ | \
grep -oP "lua-${MAJOR_MINOR}\.\d+\.tar\.gz" | \
sort -V | tail -1 | \
grep -oP "${MAJOR_MINOR}\.\d+")
echo "$version: Current=$CURRENT, Latest=$LATEST"
if [ -n "$LATEST" ] && [ "$CURRENT" != "$LATEST" ]; then
UPDATES_FOUND=true
UPDATE_SUMMARY="${UPDATE_SUMMARY}- Lua ${CURRENT} → ${LATEST}\n"
echo "UPDATE_${version}=${LATEST}" >> $GITHUB_ENV
fi
done
echo "updates_found=$UPDATES_FOUND" >> $GITHUB_OUTPUT
echo -e "$UPDATE_SUMMARY" > /tmp/update_summary.txt
- name: Download new tarballs and update README
if: steps.check.outputs.updates_found == 'true'
run: |
# Download new tarballs if version updates are found
for version in lua51 lua53 lua54 lua55; do
case $version in
lua51) MAJOR_MINOR="5.1" ;;
lua53) MAJOR_MINOR="5.3" ;;
lua54) MAJOR_MINOR="5.4" ;;
lua55) MAJOR_MINOR="5.5" ;;
esac
VAR_NAME="UPDATE_${version}"
NEW_VERSION=${!VAR_NAME}
if [ -n "$NEW_VERSION" ]; then
echo "Downloading lua-${NEW_VERSION}.tar.gz"
# Remove old tarball for this major.minor version
rm -f lua-${MAJOR_MINOR}.*.tar.gz
# Download new tarball
curl -O "https://www.lua.org/ftp/lua-${NEW_VERSION}.tar.gz"
# Calculate new SHA256
NEW_SHA=$(sha256sum "lua-${NEW_VERSION}.tar.gz" | awk '{print $1}')
# Update README with new hash
sed -i "s/lua-${MAJOR_MINOR}\.[0-9]\+\.tar\.gz.*/lua-${NEW_VERSION}.tar.gz ($(date '+%b %d %Y')) \`${NEW_SHA}\`/" README.md
fi
done
- name: Create Pull Request
if: steps.check.outputs.updates_found == 'true'
uses: peter-evans/create-pull-request@v8
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: |
Update Lua versions to latest releases
$(cat /tmp/update_summary.txt)
branch: update-lua-versions
delete-branch: true
title: 'Update Lua to latest versions'
body: |
## Lua Version Updates
This automated PR updates Lua to the latest available versions:
$(cat /tmp/update_summary.txt)
### Changes
- Downloaded new Lua tarballs from https://www.lua.org/ftp/
- Removed old tarball versions
- Updated README.md with new SHA256 checksums
- Makefile will automatically detect the new versions
Please review and merge if the updates look correct.
---
*This PR was automatically created by the check-lua-updates workflow*
labels: |
dependencies
automated