diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml new file mode 100644 index 0000000..26c16bb --- /dev/null +++ b/.forgejo/workflows/build.yml @@ -0,0 +1,80 @@ +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 }} + diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 2fdbee8..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,68 +0,0 @@ -# Adapted from https://github.com/andrewboring/alarm-images/blob/master/.github/workflows/build.yml - -name: Build Images - -on: - release: - types: - - created - -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 - strategy: - matrix: - arch: ['aarch64', 'rpi-aarch64'] - flavor: ['barebone'] - include: - - arch: rpi-aarch64 - flavor: xfce - - - - steps: - - uses: actions/checkout@v3 - - 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: sudo apt-get update && sudo apt-get install -y parted wget dosfstools zip arch-install-scripts aria2 gh git - - name: Set up QEMU - uses: 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_OUTPUT" - - name: Compress image - run: | - mkdir image_parts - zip -s 2000m "image_parts/${{ steps.rename-image.outputs.image_name }}.zip" "${{ steps.rename-image.outputs.image_name }}" - - name: Upload image - run: | - sha256sum image_parts/* > image_parts/sha256sums.${{ matrix.arch }}.${{ matrix.flavor }}.txt - gh release upload ${{ github.event.release.tag_name }} ./image_parts/* -R ${{ github.repository }} diff --git a/create-image b/create-image index 0339b3d..3333cde 100755 --- a/create-image +++ b/create-image @@ -65,8 +65,8 @@ loopdev=$(losetup --find --show "${image}") echo "==> Partitioning image..." parted --script "${loopdev}" mklabel msdos -parted --script "${loopdev}" mkpart primary fat32 0% 200M -parted --script "${loopdev}" mkpart primary ext4 200M 100% +parted --script "${loopdev}" mkpart primary fat32 0% 1024M +parted --script "${loopdev}" mkpart primary ext4 1024M 100% echo "==> Formatting image..." bootdev=$(ls "${loopdev}"*1)