Skip to content

Build Images

Build Images #39

Workflow file for this run

name: Build Images
on:
schedule:
- cron: '0 0 * * 1'
workflow_dispatch:
jobs:
build:
runs-on: [self-hosted, arch]
steps:
- name: Checkout Images
uses: actions/checkout@v4
with:
path: images
- name: Install dependencies
run: |
sudo pacman -Sy --noconfirm --needed \
python parted btrfs-progs \
git wget arch-install-scripts perl pod2man \
unzip gptfdisk dosfstools multipath-tools jq
yay -S --noconfirm --needed \
mmdebstrap debian-archive-keyring
wget https://deb-mirror.fydeos.com/pacman/repo/fyde/aarch64/python-imageforge-1.1.0-1-any.pkg.tar.zst
sudo pacman -U --noconfirm python-imageforge-1.1.0-1-any.pkg.tar.zst
- name: Build Image
run: |
sudo umount -R ./work/aarch64/* || true
sudo rm -rf /var/lib/pacman/db.lck ./out ./work ./work-deb
for i in {1..3}; do
sudo python ./images/fydetab-arch/profiledef -c ./images/fydetab-arch/ -w ./work -o ./out && break
done
for i in {1..3}; do
sudo python ./images/fydetab-debian/profiledef -c ./images/fydetab-debian/ -w ./work-deb -o ./out && break
done
- name: Cleanup
if: always()
run: |
sudo umount -R ./work/aarch64/* || true
sudo rm -rf ./work ./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_RESPONSE=$(curl -s -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"tag_name\": \"$TAG_NAME\", \"name\": \"$TAG_NAME\", \"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