Skip to content

Commit 14f7665

Browse files
committed
[chore] improved ci build and signing at release publish
1 parent 89f17f5 commit 14f7665

1 file changed

Lines changed: 46 additions & 22 deletions

File tree

.github/workflows/build.yml

Lines changed: 46 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -398,44 +398,67 @@ jobs:
398398
fi
399399
rm -f appversion.h
400400
401+
- name: Set SIGN_READY env
402+
run: |
403+
if [[ "${{ github.event_name }}" == "release" && \
404+
"${{ github.event.action }}" == "published" && \
405+
"${{ github.ref }}" == refs/tags/* ]]; then
406+
echo "SIGN_READY=true" >> $GITHUB_ENV
407+
else
408+
echo "SIGN_READY=false" >> $GITHUB_ENV
409+
fi
410+
401411
- name: Final signing and Packaging bin/dbg
402412
id: packaging-job
403-
if: |
404-
github.event_name == 'release' &&
405-
github.event.action == 'published' &&
406-
startsWith(github.ref, 'refs/tags/')
407413
run: |
408-
409-
# new runner, niw signs
410-
echo "${{ secrets.PUB_ASC }}" > "${{ secrets.PUB_ASC_FILE }}"
411-
echo "${{ secrets.KEY_ASC }}" > "${{ secrets.KEY_ASC_FILE }}"
412-
gpg --batch --yes --import "${{ secrets.PUB_ASC_FILE }}"
413-
gpg --batch --yes --import "${{ secrets.KEY_ASC_FILE }}"
414-
GPG_LINUX_FINGERPRINT=$(gpg --list-keys --with-colons | grep '^fpr' | head -n 1 | cut -d: -f10)
415-
echo "$GPG_LINUX_FINGERPRINT:6:" | gpg --batch --import-ownertrust
416-
echo "GPG_LINUX_FINGERPRINT=$GPG_LINUX_FINGERPRINT" >> $GITHUB_ENV
414+
if [[ "$SIGN_READY" == "true" ]]; then
415+
echo "Signing avalible."
416+
417+
echo "${{ secrets.PUB_ASC }}" > "${{ secrets.PUB_ASC_FILE }}"
418+
echo "${{ secrets.KEY_ASC }}" > "${{ secrets.KEY_ASC_FILE }}"
419+
gpg --batch --yes --import "${{ secrets.PUB_ASC_FILE }}"
420+
gpg --batch --yes --import "${{ secrets.KEY_ASC_FILE }}"
421+
GPG_LINUX_FINGERPRINT=$(gpg --list-keys --with-colons | grep '^fpr' | head -n 1 | cut -d: -f10)
422+
echo "$GPG_LINUX_FINGERPRINT:6:" | gpg --batch --import-ownertrust
423+
echo "GPG_LINUX_FINGERPRINT=$GPG_LINUX_FINGERPRINT" >> $GITHUB_ENV
424+
else
425+
echo "Signing skipped."
426+
fi
417427
418428
sign_file() {
419-
local file=$1
420-
gpg --batch --yes --detach-sign --armor -u "$GPG_LINUX_FINGERPRINT" "$file"
421-
if [ $? -ne 0 ]; then
422-
echo "Error: Failed to sign $file"
423-
exit 2
429+
if [[ "$SIGN_READY" == "true" ]]; then
430+
local file=$1
431+
gpg --batch --yes --detach-sign --armor -u "$GPG_LINUX_FINGERPRINT" "$file"
432+
if [ $? -ne 0 ]; then
433+
echo "Error: Failed to sign $file"
434+
exit 2
435+
fi
436+
echo "$file signed successfully."
437+
else
438+
echo "$file not signed (SIGN_READY=$SIGN_READY)"
424439
fi
425-
echo "$file signed successfully."
426440
}
427-
428-
# Pack and sign final archive
441+
442+
# Pack and try sign final archive
429443
7z a -tzip rehlds-bin-${{ env.APP_VERSION }}.zip bin/ hlsdk/
430444
sign_file "rehlds-bin-${{ env.APP_VERSION }}.zip"
431445
432-
# Pack and sign final archive
446+
# Pack and try sign final archive
433447
7z a -t7z -m0=lzma2 -mx=9 -mfb=64 -aoa rehlds-dbg-${{ env.APP_VERSION }}.7z debug/
434448
sign_file "rehlds-dbg-${{ env.APP_VERSION }}.7z"
435449
436450
shell: bash
437451

438452
- name: Publish artifacts
453+
uses: actions/upload-artifact@v4
454+
with:
455+
name: rehlds-ci-${{ env.APP_VERSION }}
456+
path: |
457+
*.zip
458+
*.7z
459+
*.asc
460+
461+
- name: Release artifacts
439462
uses: softprops/action-gh-release@v2
440463
id: publish-job
441464
if: |
@@ -446,5 +469,6 @@ jobs:
446469
*.zip
447470
*.7z
448471
*.asc
472+
449473
env:
450474
GITHUB_TOKEN: ${{ secrets.API_TOKEN }}

0 commit comments

Comments
 (0)