1+ name : Build Images
2+
3+ on :
4+ schedule :
5+ - cron : ' 0 14 1 * *'
6+ workflow_dispatch :
7+
8+ jobs :
9+ build :
10+ runs-on : ubnutu-latest
11+ steps :
12+
13+ - name : Checkout Images
14+ uses : actions/checkout@v4
15+ with :
16+ path : images
17+
18+ - name : Install dependencies
19+ run : |
20+ sudo apt install mmdebstrap parted jq btrfs-progs wget unzip multipath-tools dosfstools arch-install-scripts debian-archive-keyring git gdisk
21+ wget https://apt.ameridroid.com/stable/pool/main/i/imageforge/imageforge_1.1.0_all.deb
22+ sudo dpkg -i imageforge_1.1.0_all.deb
23+
24+
25+ - name : Build Debian Image
26+ run : |
27+ sudo umount -R ./work-deb/aarch64/* || true
28+ for i in {1..3}; do
29+ sudo python3 ./images/nova-bookworm/profiledef -c ./images/nova-bookworm/ -w ./work-deb -o ./out && break
30+ done
31+
32+ - name : Cleanup
33+ if : always()
34+ run : |
35+ sudo umount -R ./work-deb/aarch64/* || true
36+ sudo rm -rf ./work-deb
37+
38+ - name : Set current date as tag name
39+ id : set_tag_name
40+ run : echo "TAG_NAME=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
41+
42+ - name : Create Release
43+ env :
44+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
45+ REPO : ${{ github.repository }}
46+ TAG_NAME : ${{ env.TAG_NAME }}
47+ id : create_release
48+ run : |
49+ RELEASE_BODY=""
50+ for i in $(ls ./out/*.img.xz); do
51+ FILENAME=$(basename $i)
52+ SHA256=$(sha256sum $i | awk '{ print $1 }')
53+ RELEASE_BODY+="\nsha256 for $FILENAME:\n\`\`\`\n$SHA256\n\`\`\`\n"
54+ done
55+
56+ RELEASE_RESPONSE=$(curl -s -X POST \
57+ -H "Authorization: token $GITHUB_TOKEN" \
58+ -H "Content-Type: application/json" \
59+ -d "{\"tag_name\": \"$TAG_NAME\", \"name\": \"$TAG_NAME\", \"body\": \"$RELEASE_BODY\", \"draft\": false, \"prerelease\": false}" \
60+ "https://api.github.com/repos/$REPO/releases")
61+
62+ RELEASE_ID=$(echo $RELEASE_RESPONSE | jq -r '.id')
63+
64+ if [ "$RELEASE_ID" == "null" ]; then
65+ echo "Failed to create a release. Response: $RELEASE_RESPONSE"
66+ exit 1
67+ fi
68+
69+ for file in ./out/*.img.xz; do
70+ curl -X POST \
71+ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
72+ -H "Content-Type: application/octet-stream" \
73+ -T "$file" \
74+ "https://uploads.github.com/repos/${{ github.repository }}/releases/$RELEASE_ID/assets?name=$(basename "$file")"
75+ done
76+
77+ - name : Clean up
78+ run : |
79+ rm ./out/ -rf
0 commit comments