Skip to content

Commit 00e154f

Browse files
committed
Use hash-only edge release asset names
1 parent 028feae commit 00e154f

1 file changed

Lines changed: 23 additions & 6 deletions

File tree

.github/workflows/publish-edge-pre-release.yml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ jobs:
7575
echo "RELEASE_VERSION=${edge_version}" >> "${GITHUB_ENV}"
7676
echo "LINUXDO_BUILD_VERSION=${edge_version}" >> "${GITHUB_ENV}"
7777
echo "LINUXDO_GIT_HASH=${short_sha}" >> "${GITHUB_ENV}"
78+
echo "asset_hash=${short_sha}" >> "${GITHUB_OUTPUT}"
7879
7980
- uses: dtolnay/rust-toolchain@stable
8081

@@ -129,7 +130,7 @@ jobs:
129130
- name: Upload artifacts
130131
uses: actions/upload-artifact@v4
131132
with:
132-
name: linuxdo-accelerator-${{ steps.sync_version.outputs.package_version }}-${{ matrix.artifact_name }}
133+
name: linuxdo-accelerator-${{ steps.sync_version.outputs.asset_hash }}-${{ matrix.artifact_name }}
133134
path: |
134135
dist/**
135136
target/release/linuxdo-accelerator*
@@ -180,6 +181,7 @@ jobs:
180181
echo "RELEASE_VERSION=${edge_version}" >> "${GITHUB_ENV}"
181182
echo "LINUXDO_BUILD_VERSION=${edge_version}" >> "${GITHUB_ENV}"
182183
echo "LINUXDO_GIT_HASH=${short_sha}" >> "${GITHUB_ENV}"
184+
echo "asset_hash=${short_sha}" >> "${GITHUB_OUTPUT}"
183185
184186
- uses: actions/setup-java@v4
185187
with:
@@ -225,15 +227,15 @@ jobs:
225227
ANDROID_ABI: ${{ matrix.abi }}
226228
RUST_TARGET: ${{ matrix.rust_target }}
227229
ANDROID_BUILD_TYPE: release
228-
APK_OUTPUT_NAME: linuxdo-accelerator-${{ steps.sync_version.outputs.package_version }}-android-${{ matrix.abi }}.apk
230+
APK_OUTPUT_NAME: linuxdo-accelerator-${{ steps.sync_version.outputs.asset_hash }}-android-${{ matrix.abi }}.apk
229231
run: |
230232
export ANDROID_NDK_HOME="${ANDROID_SDK_ROOT}/ndk/27.2.12479018"
231233
./scripts/build-android-apk.sh
232234
233235
- name: Upload Android artifacts
234236
uses: actions/upload-artifact@v4
235237
with:
236-
name: linuxdo-accelerator-${{ steps.sync_version.outputs.package_version }}-${{ matrix.artifact_name }}
238+
name: linuxdo-accelerator-${{ steps.sync_version.outputs.asset_hash }}-${{ matrix.artifact_name }}
237239
path: |
238240
android/dist/*.apk
239241
@@ -273,17 +275,32 @@ jobs:
273275
274276
git push -f origin "${GITHUB_SHA}:refs/tags/${EDGE_TAG}"
275277
276-
short_sha="$(git rev-parse --short "${GITHUB_SHA}")"
278+
short_sha="${GITHUB_SHA::12}"
277279
notes_file="$(mktemp)"
278280
cat > "${notes_file}" <<EOF
279281
Auto-updated from main.
280282
281283
Commit: ${short_sha}
282284
Run: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}
283285
EOF
284-
mapfile -t release_files < <(
285-
find release-artifacts -type f \( -path '*/dist/*' -o -name '*.apk' \) | sort
286+
asset_hash="${GITHUB_SHA::12}"
287+
release_assets_dir="$(mktemp -d)"
288+
while IFS= read -r -d '' file; do
289+
rel_path="${file#release-artifacts/}"
290+
artifact_dir="${rel_path%%/*}"
291+
platform="${artifact_dir#linuxdo-accelerator-${asset_hash}-}"
292+
case "${file}" in
293+
*.tar.gz) ext="tar.gz" ;;
294+
*.AppImage) ext="AppImage" ;;
295+
*) ext="${file##*.}" ;;
296+
esac
297+
cp "${file}" "${release_assets_dir}/linuxdo-accelerator-${asset_hash}-${platform}.${ext}"
298+
done < <(
299+
find release-artifacts -type f \
300+
\( -name '*.apk' -o -name '*.deb' -o -name '*.dmg' -o -name '*.exe' -o -name '*.msi' -o -name '*.zip' -o -name '*.tar.gz' -o -name '*.AppImage' \) \
301+
-print0 | sort -z
286302
)
303+
mapfile -t release_files < <(find "${release_assets_dir}" -type f | sort)
287304
if [[ "${#release_files[@]}" -eq 0 ]]; then
288305
echo "no release files found" >&2
289306
exit 1

0 commit comments

Comments
 (0)