Skip to content

Build Images

Build Images #9

Workflow file for this run

name: Build Images
on:
schedule:
- cron: '0 14 1 * *'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Images
uses: actions/checkout@v4
with:
path: images
- name: Install dependencies
run: |
sudo apt install mmdebstrap parted jq btrfs-progs wget unzip multipath-tools dosfstools arch-install-scripts debian-archive-keyring git gdisk
wget https://apt.ameridroid.com/stable/pool/main/i/imageforge/imageforge_1.1.0_all.deb
sudo dpkg -i imageforge_1.1.0_all.deb
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build Debian Image
run: |
sudo umount -R ./work-deb/aarch64/* || true
for i in {1..3}; do
sudo python3 ./images/nova-bookworm/profiledef -c ./images/nova-bookworm/ -w ./work-deb -o ./out && break
done
- name: Cleanup
if: always()
run: |
sudo umount -R ./work-deb/aarch64/* || true
sudo rm -rf ./work-deb
- name: Set current date as tag name
id: set_tag_name
run: echo "TAG_NAME=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
TAG_NAME: ${{ env.TAG_NAME }}
id: create_release
run: |
RELEASE_BODY=""
for i in $(ls ./out/*.img.xz); do
FILENAME=$(basename $i)
SHA256=$(sha256sum $i | awk '{ print $1 }')
RELEASE_BODY+="\nsha256 for $FILENAME:\n\`\`\`\n$SHA256\n\`\`\`\n"
done
RELEASE_RESPONSE=$(curl -s -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"tag_name\": \"$TAG_NAME\", \"name\": \"$TAG_NAME\", \"body\": \"$RELEASE_BODY\", \"draft\": false, \"prerelease\": false}" \
"https://api.github.com/repos/$REPO/releases")
RELEASE_ID=$(echo $RELEASE_RESPONSE | jq -r '.id')
if [ "$RELEASE_ID" == "null" ]; then
echo "Failed to create a release. Response: $RELEASE_RESPONSE"
exit 1
fi
for file in ./out/*.img.xz; do
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/octet-stream" \
-T "$file" \
"https://uploads.github.com/repos/${{ github.repository }}/releases/$RELEASE_ID/assets?name=$(basename "$file")"
done
- name: Clean up
run: |
rm ./out/ -rf