1- name : Check if ISO can be built.
1+ name : Check if ISO can be built
22
33on :
44 pull_request :
55 branches :
66 - main
77 workflow_dispatch :
88 schedule :
9- - cron : ' 0 0 * * *' # Run the workflow every day at midnight
9+ - cron : ' 0 0 * * *'
1010
1111jobs :
1212 build :
13- runs-on : ubuntu-latest # Use a standard runner
13+ runs-on : ubuntu-latest
1414
1515 steps :
1616 - name : Checkout Repository
2222
2323 - name : Build ISO in Arch Container
2424 run : |
25- set -e
2625 docker exec arch-container bash -c "
2726 pacman -Syu --noconfirm &&
2827 pacman -S --noconfirm git archiso grub &&
@@ -32,16 +31,11 @@ jobs:
3231
3332 - name : Rename ISO to Arch.iso
3433 run : |
35- set -e
3634 docker exec arch-container bash -c "
3735 iso_file=\$(ls /workdir/out/*.iso 2>/dev/null | head -n 1) &&
3836 [ -n \"\$iso_file\" ] && mv \$iso_file /workdir/out/Arch.iso || echo 'No ISO file found.'
3937 "
4038
41- - name : List ISO files
42- run : |
43- docker exec arch-container bash -c "ls -l /workdir/out/" || echo 'Failed to list files.'
44-
4539 - name : Copy ISO to Host
4640 run : |
4741 docker cp arch-container:/workdir/out/Arch.iso ${{ github.workspace }}/ || echo 'Failed to copy ISO to host.'
@@ -50,21 +44,18 @@ jobs:
5044 id : date
5145 run : echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
5246
53- # Create a release on GitHub using GITHUB_TOKEN
5447 - name : Create GitHub Release
55- id : create_release # Adding an ID to reference the release step
48+ id : create_release
56495750 env :
5851 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
5952 with :
6053 tag_name : v${{ github.run_id }}-release
6154 release_name : " Arch Linux Release"
62- body : |
63- This release contains the Arch Linux ISO built on ${{ steps.date.outputs.date }}.
55+ body : " Arch Linux ISO built on ${{ steps.date.outputs.date }}"
6456 draft : false
6557 prerelease : false
6658
67- # Upload the ISO to the GitHub release with a specific, predictable name
6859 - name : Upload ISO to GitHub Release
6960 uses : actions/upload-release-asset@v1
7061 env :
@@ -75,27 +66,27 @@ jobs:
7566 asset_name : Arch.iso
7667 asset_content_type : application/octet-stream
7768
78- # Delete the release after uploading the asset
7969 - name : Delete GitHub Release
8070 env :
8171 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
82- RELEASE_ID : ${{ steps.create_release.outputs.release_id }}
8372 run : |
73+ release_id=$(curl -s \
74+ -H "Authorization: token $GITHUB_TOKEN" \
75+ -H "Accept: application/vnd.github.v3+json" \
76+ https://api.github.com/repos/${{ github.repository }}/releases/tags/v${{ github.run_id }}-release | jq -r .id) &&
8477 curl -X DELETE \
8578 -H "Authorization: token $GITHUB_TOKEN" \
8679 -H "Accept: application/vnd.github.v3+json" \
87- https://api.github.com/repos/${{ github.repository }}/releases/$RELEASE_ID
80+ https://api.github.com/repos/${{ github.repository }}/releases/$release_id
8881
89- # Delete the tag associated with the release
9082 - name : Delete Git Tag
9183 env :
9284 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
93- TAG_NAME : v${{ github.run_id }}-release
9485 run : |
9586 curl -X DELETE \
9687 -H "Authorization: token $GITHUB_TOKEN" \
9788 -H "Accept: application/vnd.github.v3+json" \
98- https://api.github.com/repos/${{ github.repository }}/git/refs/tags/$TAG_NAME
89+ https://api.github.com/repos/${{ github.repository }}/git/refs/tags/v${{ github.run_id }}-release
9990
10091 - name : Clean Up
10192 run : |
0 commit comments