Skip to content

Commit 16c6c1b

Browse files
committed
feat: Generate sha256 file for published releases
Closes #501
1 parent 735b0df commit 16c6c1b

File tree

3 files changed

+55
-4
lines changed

3 files changed

+55
-4
lines changed

.github/workflows/glpi-agent-packaging.yml

+49-4
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,43 @@ jobs:
756756

757757
steps:
758758
- uses: actions/checkout@v4
759+
- uses: actions/download-artifact@v4
760+
with:
761+
name: Linux-Installer-Build
762+
- uses: actions/download-artifact@v4
763+
with:
764+
name: RPM-Build
765+
- uses: actions/download-artifact@v4
766+
with:
767+
name: Debian-Build
768+
- uses: actions/download-artifact@v4
769+
with:
770+
name: Snap-Build
771+
- uses: actions/download-artifact@v4
772+
with:
773+
name: Linux-AppImage-Build
774+
- uses: actions/download-artifact@v4
775+
with:
776+
pattern: MacOSX-Build-*
777+
merge-multiple: true
778+
- uses: actions/download-artifact@v4
779+
with:
780+
pattern: Windows-Build-*
781+
merge-multiple: true
782+
- uses: actions/download-artifact@v4
783+
with:
784+
name: Sources
785+
- name: Generate and upload sha256 file
786+
id: upload-sha256-asset
787+
run: |
788+
# Clean up not published files from Debian-Build
789+
rm -f *.buildinfo *.changes
790+
sha256sum *$VERSION* > glpi-agent-$VERSION.sha256
791+
gh release upload ${{ needs.setup-release.outputs.tag_name }} glpi-agent-$VERSION.sha256
792+
shell: bash
793+
env:
794+
VERSION: ${{ needs.setup-release.outputs.version }}
795+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
759796
- name: Publish release
760797
id: publish-release
761798
run: |
@@ -874,26 +911,34 @@ jobs:
874911
;;
875912
esac
876913
# Get script to prepare page
914+
cd glpi-agent
877915
curl -L -s -o github-nightly-description.sh https://github.com/glpi-project/glpi-agent/raw/develop/tools/github-nightly-description.sh
878916
chmod +x github-nightly-description.sh
917+
sha256sum *${{ needs.setup-release.outputs.version }}* >sha256.txt
918+
mv sha256.txt glpi-agent-${{ needs.setup-release.outputs.version }}.sha256
879919
./github-nightly-description.sh --header --version ${{ needs.setup-release.outputs.version }} >index.md.new
880920
git config --local user.email "${{ needs.setup-release.outputs.user-email }}"
881921
git config --local user.name "${{ needs.setup-release.outputs.user-name }}"
882-
egrep '^# ' glpi-agent/index.md | \
922+
egrep '^# ' index.md | \
883923
while read dash agent version x
884924
do
885925
VERSION="${version#v}"
886926
if (( --COUNT > 0 )); then
887927
echo "Keeping glpi-agent $VERSION build"
888-
read date time tz <<<$(git log -n1 --pretty=%ci -- glpi-agent/glpi-agent_${VERSION}_all.deb)
928+
if [ ! -e glpi-agent-$VERSION.sha256 ]; then
929+
sha256sum *$VERSION* >sha256.txt
930+
mv sha256.txt glpi-agent-$VERSION.sha256
931+
fi
932+
read date time tz <<<$(git log -n1 --pretty=%ci -- glpi-agent_${VERSION}_all.deb)
889933
./github-nightly-description.sh --version $VERSION --date "$date $time UTC" >>index.md.new
890934
else
891935
echo "Removing glpi-agent $VERSION build"
892-
git filter-branch --prune-empty -f --index-filter "git rm --cached --ignore-unmatch glpi-agent/*$VERSION*" HEAD
936+
git filter-branch --prune-empty -f --index-filter "git rm --cached --ignore-unmatch *$VERSION*" HEAD
893937
fi
894938
done
895-
mv -vf index.md.new glpi-agent/index.md
939+
mv -vf index.md.new index.md
896940
rm -f github-nightly-description.sh
941+
cd ..
897942
echo "Repository status:"
898943
git status
899944
ls -lt glpi-agent

tools/github-nightly-description.sh

+3
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ Cron | [glpi-agent-cron-${VERSION}.noarch.rpm](glpi-agent-cron-${VERSION}.noarch
126126
127127
[GLPI-Agent-${VERSION}.tar.gz](GLPI-Agent-${VERSION}.tar.gz)
128128
129+
## SHA256 sums
130+
All sha256 sums for released filed can be retrieved from [glpi-agent-${VERSION}.sha256](glpi-agent-${VERSION}.sha256).
131+
129132
<p><a href='#content'>Back to top</a></p>
130133
---
131134

tools/github-release-description.sh

+3
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,7 @@ Cron | [glpi-agent-cron-${VERSION}${RPMREV}.noarch.rpm]($REPO/releases/download/
9898
## Sources
9999
[GLPI-Agent-${VERSION}.tar.gz]($REPO/releases/download/$TAG/GLPI-Agent-${VERSION}.tar.gz)
100100
101+
## SHA256 sums
102+
All sha256 sums for released filed can be retrieved from [glpi-agent-${VERSION}.sha256](glpi-agent-${VERSION}.sha256).
103+
101104
DESCRIPTION

0 commit comments

Comments
 (0)