Skip to content

Update build.yml

Update build.yml #3

Workflow file for this run

name: Build ISO
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
schedule:
- cron: '0 0 1 * *' # Monthly run
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Arch Linux Container
run: |
docker run --privileged --name arch-container -d -v ${{ github.workspace }}:/workdir archlinux:latest sleep infinity
- name: Build ISO in Arch Container
run: |
docker exec arch-container bash -c "
pacman -Syu --noconfirm &&
pacman -S --noconfirm git archiso grub &&
cd /workdir &&
mkarchiso -v -w workdir/ -o out/ .
"
- name: Rename ISO to Arch
run: |
docker exec arch-container bash -c "
iso_file=\$(ls /workdir/out/*.iso | head -n 1) &&
mv \$iso_file /workdir/out/Arch.iso
"
- name: List ISO files
run: docker exec arch-container bash -c "ls -l /workdir/out/"
- name: Copy ISO to Host
run: docker cp arch-container:/workdir/out/Arch.iso ${{ github.workspace }}/
- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1 # Consider updating to v1.1.0 or newer
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "v${{ steps.date.outputs.date }}-release"
release_name: "Arch Linux ISO Release - ${{ steps.date.outputs.date }}"
body: "This release contains the Arch Linux ISO built on ${{ steps.date.outputs.date }}."
draft: false
prerelease: false
- name: Upload ISO to GitHub Release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/Arch.iso
asset_name: Arch-${{ steps.date.outputs.date }}.iso
asset_content_type: application/octet-stream
- name: Clean Up
run: |
docker stop arch-container
docker rm arch-container