Skip to content

Commit 436c429

Browse files
Refactor GitHub Actions workflows to use Docker run action for building Arch Linux ISO and streamline ISO handling process
1 parent ca9aea5 commit 436c429

File tree

3 files changed

+49
-95
lines changed

3 files changed

+49
-95
lines changed

.github/workflows/build-check.yaml

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,16 @@ jobs:
1616
- name: Checkout Repository
1717
uses: actions/checkout@v4
1818

19-
- name: Set up Arch Linux Container
20-
run: |
21-
docker run --privileged --name arch-container -d -v ${{ github.workspace }}:/workdir archlinux:latest sleep infinity
22-
23-
- name: Build ISO in Arch Container
24-
run: |
25-
docker exec arch-container bash -c "
26-
pacman -Syu --noconfirm &&
27-
pacman -S --noconfirm git archiso grub &&
28-
cd /workdir &&
19+
- name: Build ISO in Arch Linux container
20+
uses: addnab/docker-run-action@v3
21+
with:
22+
image: archlinux:latest
23+
options: --privileged
24+
run: |
25+
pacman -Syu --noconfirm
26+
pacman -S --noconfirm git archiso grub
2927
mkarchiso -v -w workdir/ -o out/ .
30-
"
31-
32-
- name: Rename ISO to Arch.iso
33-
run: |
34-
docker exec arch-container bash -c "
35-
iso_file=\$(ls /workdir/out/*.iso 2>/dev/null | head -n 1) &&
36-
[ -n \"\$iso_file\" ] && mv \$iso_file /workdir/out/Arch.iso || echo 'No ISO file found.'
37-
"
38-
39-
- name: Copy ISO to Host
40-
run: |
41-
docker cp arch-container:/workdir/out/Arch.iso ${{ github.workspace }}/ || echo 'Failed to copy ISO to host.'
28+
mv out/*.iso out/Arch.iso
4229
4330
- name: Get current date
4431
id: date
@@ -62,7 +49,7 @@ jobs:
6249
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6350
with:
6451
upload_url: ${{ steps.create_release.outputs.upload_url }}
65-
asset_path: ${{ github.workspace }}/Arch.iso
52+
asset_path: out/Arch.iso
6653
asset_name: Arch.iso
6754
asset_content_type: application/octet-stream
6855

@@ -87,8 +74,3 @@ jobs:
8774
-H "Authorization: token $GITHUB_TOKEN" \
8875
-H "Accept: application/vnd.github.v3+json" \
8976
https://api.github.com/repos/${{ github.repository }}/git/refs/tags/v${{ github.run_id }}-release
90-
91-
- name: Clean Up
92-
run: |
93-
docker stop arch-container || echo 'Failed to stop the container.'
94-
docker rm arch-container || echo 'Failed to remove the container.'

.github/workflows/build.yaml

Lines changed: 23 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -7,72 +7,33 @@ on:
77

88
jobs:
99
build:
10-
runs-on: ubuntu-latest # Use a standard runner
10+
runs-on: ubuntu-latest
1111

1212
steps:
13-
- name: Checkout Repository
14-
uses: actions/checkout@v4
15-
16-
- name: Set up Arch Linux Container
17-
run: |
18-
docker run --privileged --name arch-container -d -v ${{ github.workspace }}:/workdir archlinux:latest sleep infinity
19-
20-
- name: Build ISO in Arch Container
21-
run: |
22-
set -e
23-
docker exec arch-container bash -c "
24-
pacman -Syu --noconfirm &&
25-
pacman -S --noconfirm git archiso grub &&
26-
cd /workdir &&
27-
mkarchiso -v -w workdir/ -o out/ .
28-
"
29-
30-
- name: Rename ISO to Arch.iso
31-
run: |
32-
set -e
33-
docker exec arch-container bash -c "
34-
iso_file=\$(ls /workdir/out/*.iso 2>/dev/null | head -n 1) &&
35-
[ -n \"\$iso_file\" ] && mv \$iso_file /workdir/out/Arch.iso || echo 'No ISO file found.'
36-
"
37-
38-
- name: List ISO files
39-
run: |
40-
docker exec arch-container bash -c "ls -l /workdir/out/" || echo 'Failed to list files.'
41-
42-
- name: Copy ISO to Host
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Build ISO in Arch Linux container
17+
uses: addnab/docker-run-action@v3
18+
with:
19+
image: archlinux:latest
20+
options: --privileged
4321
run: |
44-
docker cp arch-container:/workdir/out/Arch.iso ${{ github.workspace }}/ || echo 'Failed to copy ISO to host.'
22+
pacman -Syu --noconfirm
23+
pacman -S --noconfirm git archiso grub
24+
mkarchiso -v -w workdir/ -o out/ .
25+
mv out/*.iso out/Arch.iso
4526

4627
- name: Get current date
47-
id: date
48-
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
28+
id: date
29+
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
4930

50-
# Create a release on GitHub using GITHUB_TOKEN
5131
- name: Create GitHub Release
52-
id: create_release # Adding an ID to reference the release step
53-
uses: actions/[email protected]
54-
env:
55-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56-
with:
57-
tag_name: v${{ github.run_id }}-release
58-
release_name: "Arch Linux Release"
59-
body: |
60-
This release contains the Arch Linux ISO built on ${{ steps.date.outputs.date }}.
61-
draft: false
62-
prerelease: false
63-
64-
# Upload the ISO to the GitHub release with a specific, predictable name
65-
- name: Upload ISO to GitHub Release
66-
uses: actions/upload-release-asset@v1
67-
env:
68-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69-
with:
70-
upload_url: ${{ steps.create_release.outputs.upload_url }}
71-
asset_path: ${{ github.workspace }}/Arch.iso
72-
asset_name: Arch.iso
73-
asset_content_type: application/octet-stream
74-
75-
- name: Clean Up
76-
run: |
77-
docker stop arch-container || echo 'Failed to stop the container.'
78-
docker rm arch-container || echo 'Failed to remove the container.'
32+
uses: softprops/action-gh-release@v1
33+
with:
34+
files: out/Arch.iso
35+
tag_name: v${{ github.run_id }}-release
36+
release_name: "Arch Linux Release"
37+
body: |
38+
This release contains the Arch Linux ISO built on ${{ steps.date.outputs.date }}.
39+
token: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,22 @@ This repository provides a customized Arch Linux ISO with the system beeps disab
77

88
## Features
99

10-
- **Silent Mode**: The systemd-boot beep and other annoying beeps are completely disabled.
11-
- **Arch Linux Base**: Built on the latest Arch Linux, providing a clean and minimal system.
12-
- **Custom ISO**: Easily build and download a custom ISO with this configuration.
13-
- **Daily Automated Build**: ISO builds are automatically generated and released daily (if using GitHub Actions).
14-
10+
- **Silent Mode**: Disables systemd-boot and other system beeps for a quieter experience.
11+
- **Arch Linux Base**: Utilizes the latest Arch Linux for a clean and minimal system.
12+
- **Custom ISO**: Provides an easy way to build and download a custom ISO.
13+
- **Automated Daily Builds**: Automatically generates and releases ISO builds daily using GitHub Actions.
14+
15+
## Table of Contents
16+
17+
- [Features](#features)
18+
- [How to Build the ISO Locally](#how-to-build-the-iso-locally)
19+
- [Prerequisites](#prerequisites)
20+
- [Steps to Build Locally](#steps-to-build-locally)
21+
- [How to Use GitHub Actions (Automated Workflow)](#how-to-use-github-actions-automated-workflow)
22+
- [How It Works](#how-it-works)
23+
- [GitHub Actions Workflow Overview](#github-actions-workflow-overview)
24+
- [How to Trigger the GitHub Workflow](#how-to-trigger-the-github-workflow)
25+
- [License](#license)
1526
---
1627

1728
## How to Build the ISO Locally

0 commit comments

Comments
 (0)