Skip to content

Commit 537855d

Browse files
committed
Set file modification times based on Git commits and add said files in alphabetical order to when creating Zips. This ensures Zip files built by CI workflows have checksum hash consistency.
1 parent 880f3b2 commit 537855d

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

.github/workflows/LuaWatcom.yml

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,21 @@ jobs:
8080
run: |
8181
lua demo/xtra/PE95TIME.LUA dist/bin/LUANT.EXE
8282
83+
- name: Set modification time on all repository files to their respective commit
84+
run: |
85+
git ls-files -z | xargs -0 -I{} touch --date="$(git log -1 --pretty=format:%cI -- {})" {}
86+
87+
- name: Set modification time on built binaries to the latest commit
88+
run: |
89+
touch --date="$(git log -1 --pretty=format:%cI)" dist/bin/*.EXE
90+
8391
- name: Create Binaries Zip
8492
run: |
85-
zip -j9 --DOS-names dist/LuaExe.zip dist/bin/*.EXE demo/core/*.LUA demo/xtra/*.LUA
86-
mv dist/LuaExe.zip "dist/WLE$(sha256sum dist/LuaExe.zip | awk '{print $1}' | cut -c1-5).zip"
93+
files=$(find dist/bin/*.EXE demo/core/*.LUA demo/xtra/*.LUA | sort | xargs)
94+
zip -j9 --DOS-names dist/LuaExe.zip $files
95+
name="dist/WLE$(sha256sum dist/LuaExe.zip | awk '{print $1}' | cut -c1-5).zip"
96+
mv dist/LuaExe.zip $name
97+
touch --date="$(git log -1 --pretty=format:%cI)" $name
8798
8899
- name: UPX Binary Compression
89100
uses: crazy-max/ghaction-upx@v3
@@ -95,6 +106,10 @@ jobs:
95106
dist/bin/LUA4G.EXE
96107
dist/bin/LUANT.EXE
97108
109+
- name: Set modification time on UPX compressed binaries to the latest commit
110+
run: |
111+
touch --date="$(git log -1 --pretty=format:%cI)" dist/bin/*.EXE
112+
98113
- name: Create 160k 16-bit DOS Floppy Diskette Image
99114
run: |
100115
mformat -C -i dist/Lua160k.ima -v "LUA DOS" -f 160
@@ -107,14 +122,18 @@ jobs:
107122
108123
- name: Create Floppy Disk Images Zip
109124
run: |
110-
zip -j9 --DOS-names dist/LuaIma.zip dist/*.ima
111-
mv dist/LuaIma.zip "dist/WLI$(sha256sum dist/LuaIma.zip | awk '{print $1}' | cut -c1-5).zip"
125+
files=$(find dist/*ima | sort | xargs)
126+
touch --date="$(git log -1 --pretty=format:%cI)" $files
127+
zip -j9 --DOS-names dist/LuaIma.zip $files
128+
name="dist/WLI$(sha256sum dist/LuaIma.zip | awk '{print $1}' | cut -c1-5).zip"
129+
mv dist/LuaIma.zip $name
130+
touch --date="$(git log -1 --pretty=format:%cI)" $name
112131
113132
- name: Upload Artifacts
114133
uses: actions/upload-artifact@v4
115134
with:
116-
name: 'LuaBin'
117-
path: dist/*.zip
135+
name: 'LuaDist'
136+
path: dist/WLE*.zip dist/WLI*.zip
118137
compression-level: 0
119138

120139
Draft:
@@ -153,9 +172,9 @@ jobs:
153172
154173
formatted_date="${day}${suffix} of ${month} ${year}"
155174
sed -i "s/{{DATE}}/${formatted_date}/g" .github/workflows/notes.md
156-
name="$(ls LuaBin/WLE*.zip | xargs -n 1 basename)"
175+
name="$(ls LuaDist/WLE*.zip | xargs -n 1 basename)"
157176
sed -i "s/{{WLE}}/${name}/g" .github/workflows/notes.md
158-
name="$(ls LuaBin/WLI*.zip | xargs -n 1 basename)"
177+
name="$(ls LuaDist/WLI*.zip | xargs -n 1 basename)"
159178
sed -i "s/{{WLI}}/${name}/g" .github/workflows/notes.md
160179
161180
- name: Create Draft Release
@@ -167,4 +186,4 @@ jobs:
167186
--draft \
168187
--title "$TAG_NAME" \
169188
--notes-file .github/workflows/notes.md \
170-
"LuaBin/*.zip"
189+
"LuaDist/*.zip"

0 commit comments

Comments
 (0)