Parchlinuxarm-images/.forgejo/workflows/build.yml
2025-03-19 14:20:46 +03:30

80 lines
2.3 KiB
YAML

name: Build Images
on:
release:
types:
- created
workflow_dispatch: # Allows manual triggering
env:
api_key: ${{ secrets.GITHUB_TOKEN }}
name: ${{ github.event.repository.name }}
release_name: ${{ github.ref_name }}
GH_TOKEN: ${{ github.token }}
jobs:
build:
permissions:
contents: write
runs-on: ubuntu-latest
container:
image: archlinux/archlinux:base-devel
privileged: true
strategy:
matrix:
arch: ['aarch64', 'rpi-aarch64']
flavor: ['barebone']
include:
- arch: rpi-aarch64
flavor: xfce
steps:
- name: nodejs installation
run: pacman -Syu nodejs base-devel git --noconfirm
- uses: actions/checkout@v4
- name: Configure Git user
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Install dependencies
run: pacman -Sy && pacman -S --noconfirm parted wget dosfstools zip arch-install-scripts aria2 github-cli git
- name: Set up QEMU
uses: https://github.com/docker/setup-qemu-action@v2
with:
platforms: arm,arm64
- name: Build image
shell: bash
run: |
scripts=()
for script_name in "${{ matrix.arch }}" "${{ matrix.flavor }}" "${{ matrix.arch }}-${{ matrix.flavor }}"; do
script_path="setup/$script_name"
if [ -f "$script_path" ]; then
scripts+=("$script_path")
fi
done
sudo ./create-image 9G ${{ matrix.arch }} "${scripts[@]}"
- name: Rename image
id: rename-image
run: |
image_in_name="archlinux-${{ matrix.arch }}.img"
image_out_name="Parchlinux-${{ matrix.arch }}-${{ matrix.flavor }}-$(date '+%Y-%m-%d').img"
mv "$image_in_name" "$image_out_name"
echo "image_name=$image_out_name" >> "$GITHUB_ENV"
- name: Compress image
run: |
mkdir image_parts
zip -s 2000m "image_parts/${{ env.image_name }}" "${{ env.image_name }}"
- name: Upload image
run: |
sha256sum image_parts/* > image_parts/sha256sums.${{ matrix.arch }}.${{ matrix.flavor }}.txt
gh release upload ${{ github.ref_name }} image_parts/* -R ${{ github.repository }}