Skip to content

Commit 00b7c53

Browse files
Refactor GitHub Actions workflow to use docker-run-action for building Arch Linux ISO and simplify container management
1 parent cf52d5b commit 00b7c53

File tree

1 file changed

+17
-52
lines changed

1 file changed

+17
-52
lines changed

.github/workflows/build.yaml

Lines changed: 17 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -13,66 +13,31 @@ jobs:
1313
- name: Checkout Repository
1414
uses: actions/checkout@v4
1515

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 &&
16+
- name: Build ISO in Arch Linux Container
17+
uses: addnab/docker-run-action@v3
18+
with:
19+
image: archlinux:latest
20+
options: >
21+
--privileged
22+
--workdir /workdir
23+
-v ${{ github.workspace }}:/workdir
24+
run: |
25+
pacman -Syu --noconfirm
26+
pacman -S --noconfirm git archiso grub
2727
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
43-
run: |
44-
docker cp arch-container:/workdir/out/Arch.iso ${{ github.workspace }}/ || echo 'Failed to copy ISO to host.'
4528
4629
- name: Get current date
4730
id: date
4831
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
4932

50-
# Create a release on GitHub using GITHUB_TOKEN
5133
- 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 }}
34+
uses: ncipollo/release-action@v1
5635
with:
57-
tag_name: v${{ github.run_id }}-release
58-
release_name: "Arch Linux Release"
36+
token: ${{ secrets.GITHUB_TOKEN }}
37+
tag: v${{ github.run_id }}-release
38+
name: "Arch Linux Release"
5939
body: |
6040
This release contains the Arch Linux ISO built on ${{ steps.date.outputs.date }}.
41+
artifacts: out/Arch.iso
6142
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.'
43+
prerelease: false

0 commit comments

Comments
 (0)