Skip to content

Commit cd87f3d

Browse files
committed
Added APK checksums to release description for build verification.
1 parent aac91bf commit cd87f3d

1 file changed

Lines changed: 49 additions & 6 deletions

File tree

.github/workflows/tandroid.yml

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ jobs:
8080
mkdir -p artifact
8181
mv TMessagesProj_App/build/outputs/apk/afat/${{ matrix.type }}/app.apk app.apk
8282
cp app.apk "artifact/ForkClient $(cat ver.txt)${{ matrix.name }}.apk"
83-
mkdir -p tag_asset
84-
cp app.apk "tag_asset/ForkClient_$(cat ver.txt)${{ matrix.name }}.apk"
83+
sha256sum app.apk > "artifact/ForkClient $(cat ver.txt)${{ matrix.name }}.apk.sha256"
8584
8685
# Upload to channel.
8786
set +x
@@ -103,7 +102,35 @@ jobs:
103102
name: Upload artifact
104103
with:
105104
name: ForkClient-${{ matrix.type }}
106-
path: artifact/
105+
path: |
106+
artifact/*.apk
107+
108+
checksum:
109+
name: Generate Checksums
110+
needs: linux
111+
runs-on: ubuntu-latest
112+
strategy:
113+
matrix:
114+
type: [debug, release]
115+
steps:
116+
- name: Download APK artifact
117+
uses: actions/download-artifact@v4.3.0
118+
with:
119+
name: ForkClient-${{ matrix.type }}
120+
path: apk_files
121+
- name: Generate SHA256
122+
run: |
123+
cd apk_files
124+
for apk in *.apk; do
125+
hash=$(sha256sum "$apk" | cut -d' ' -f1)
126+
echo "$hash" > "${apk}.sha256"
127+
echo "SHA256_HASH=${hash}" >> $GITHUB_ENV
128+
done
129+
- name: Upload checksums
130+
uses: actions/upload-artifact@master
131+
with:
132+
name: ${{ env.SHA256_HASH }}
133+
path: apk_files/*.sha256
107134

108135
release:
109136
name: Create Release.
@@ -126,15 +153,31 @@ jobs:
126153
find debug_asset -name "*.apk" | head -1 | sed 's/.*ForkClient //;s/\.apk//' > version.txt
127154
echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
128155
echo "OFFICIAL_VERSION=$(cat version.txt | sed 's/..$//')" >> $GITHUB_ENV
156+
- name: Generate checksums for verification
157+
run: |
158+
echo "— Updated to ${{ env.OFFICIAL_VERSION }} build of the official Telegram." > release_body.txt
159+
echo "" >> release_body.txt
160+
echo "**Build Verification:**" >> release_body.txt
161+
echo "- Workflow: [${{ github.workflow }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> release_body.txt
162+
echo "- Commit: [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})" >> release_body.txt
163+
echo "" >> release_body.txt
164+
echo "**APK SHA256:**" >> release_body.txt
165+
for file in debug_asset/*.apk release_asset/*.apk; do
166+
if [ -f "$file" ]; then
167+
filename=$(basename "$file")
168+
checksum=$(sha256sum "$file" | cut -d' ' -f1)
169+
echo "- $filename: \`$checksum\`" >> release_body.txt
170+
fi
171+
done
129172
- name: Create Release
130173
uses: softprops/action-gh-release@v0.1.15
131174
env:
132175
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
133176
with:
134177
draft: true
135178
files: |
136-
debug_asset/*
137-
release_asset/*
179+
debug_asset/*.apk
180+
release_asset/*.apk
138181
tag_name: ${{ env.VERSION }}
139182
name: "ForkClient ${{ env.VERSION }}"
140-
body: "— Updated to ${{ env.OFFICIAL_VERSION }} build of the official Telegram."
183+
body_path: release_body.txt

0 commit comments

Comments
 (0)