Skip to content

Commit a414941

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 a414941

File tree

1 file changed

+34
-11
lines changed

1 file changed

+34
-11
lines changed

.github/workflows/LuaWatcom.yml

Lines changed: 34 additions & 11 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,26 +106,38 @@ 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
101-
mcopy -i dist/Lua160k.ima dist/bin/LUA16.EXE demo/core/*.LUA ::
116+
files=$(find dist/bin/LUA16.EXE demo/core/*.LUA | sort | xargs)
117+
mcopy -i dist/Lua160k.ima $files ::
102118
103119
- name: Create 1.4M Multi-Platform Floppy Diskette Image
104120
run: |
105121
mformat -C -i dist/LuaMulti.ima -v "LUA MULTIOS" -f 1440
106-
mcopy -i dist/LuaMulti.ima dist/bin/*.EXE demo/core/*.LUA demo/xtra/*.LUA ::
122+
files=$(find dist/bin/*.EXE demo/core/*.LUA demo/xtra/*.LUA | sort | xargs)
123+
mcopy -i dist/LuaMulti.ima $files ::
107124
108125
- name: Create Floppy Disk Images Zip
109126
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"
127+
files=$(find dist/*ima | sort | xargs)
128+
touch --date="$(git log -1 --pretty=format:%cI)" $files
129+
zip -j9 --DOS-names dist/LuaIma.zip $files
130+
name="dist/WLI$(sha256sum dist/LuaIma.zip | awk '{print $1}' | cut -c1-5).zip"
131+
mv dist/LuaIma.zip $name
132+
touch --date="$(git log -1 --pretty=format:%cI)" $name
112133
113134
- name: Upload Artifacts
114135
uses: actions/upload-artifact@v4
115136
with:
116-
name: 'LuaBin'
117-
path: dist/*.zip
137+
name: 'LuaDist'
138+
path: |
139+
dist/WLE*.zip
140+
dist/WLI*.zip
118141
compression-level: 0
119142

120143
Draft:
@@ -153,9 +176,9 @@ jobs:
153176
154177
formatted_date="${day}${suffix} of ${month} ${year}"
155178
sed -i "s/{{DATE}}/${formatted_date}/g" .github/workflows/notes.md
156-
name="$(ls LuaBin/WLE*.zip | xargs -n 1 basename)"
179+
name="$(ls LuaDist/WLE*.zip | xargs -n 1 basename)"
157180
sed -i "s/{{WLE}}/${name}/g" .github/workflows/notes.md
158-
name="$(ls LuaBin/WLI*.zip | xargs -n 1 basename)"
181+
name="$(ls LuaDist/WLI*.zip | xargs -n 1 basename)"
159182
sed -i "s/{{WLI}}/${name}/g" .github/workflows/notes.md
160183
161184
- name: Create Draft Release
@@ -167,4 +190,4 @@ jobs:
167190
--draft \
168191
--title "$TAG_NAME" \
169192
--notes-file .github/workflows/notes.md \
170-
"LuaBin/*.zip"
193+
"LuaDist/*.zip"

0 commit comments

Comments
 (0)