Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 11 additions & 20 deletions .github/workflows/build-check.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Check if ISO can be built.
name: Check if ISO can be built

on:
pull_request:
branches:
- main
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # Run the workflow every day at midnight
- cron: '0 0 * * *'

jobs:
build:
runs-on: ubuntu-latest # Use a standard runner
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
Expand All @@ -22,7 +22,6 @@ jobs:

- name: Build ISO in Arch Container
run: |
set -e
docker exec arch-container bash -c "
pacman -Syu --noconfirm &&
pacman -S --noconfirm git archiso grub &&
Expand All @@ -32,16 +31,11 @@ jobs:

- name: Rename ISO to Arch.iso
run: |
set -e
docker exec arch-container bash -c "
iso_file=\$(ls /workdir/out/*.iso 2>/dev/null | head -n 1) &&
[ -n \"\$iso_file\" ] && mv \$iso_file /workdir/out/Arch.iso || echo 'No ISO file found.'
"

- name: List ISO files
run: |
docker exec arch-container bash -c "ls -l /workdir/out/" || echo 'Failed to list files.'

- name: Copy ISO to Host
run: |
docker cp arch-container:/workdir/out/Arch.iso ${{ github.workspace }}/ || echo 'Failed to copy ISO to host.'
Expand All @@ -50,21 +44,18 @@ jobs:
id: date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT

# Create a release on GitHub using GITHUB_TOKEN
- name: Create GitHub Release
id: create_release # Adding an ID to reference the release step
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.run_id }}-release
release_name: "Arch Linux Release"
body: |
This release contains the Arch Linux ISO built on ${{ steps.date.outputs.date }}.
body: "Arch Linux ISO built on ${{ steps.date.outputs.date }}"
draft: false
prerelease: false

# Upload the ISO to the GitHub release with a specific, predictable name
- name: Upload ISO to GitHub Release
uses: actions/upload-release-asset@v1
env:
Expand All @@ -75,27 +66,27 @@ jobs:
asset_name: Arch.iso
asset_content_type: application/octet-stream

# Delete the release after uploading the asset
- name: Delete GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_ID: ${{ steps.create_release.outputs.release_id }}
run: |
release_id=$(curl -s \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/releases/tags/v${{ github.run_id }}-release | jq -r .id) &&
curl -X DELETE \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/releases/$RELEASE_ID
https://api.github.com/repos/${{ github.repository }}/releases/$release_id

# Delete the tag associated with the release
- name: Delete Git Tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_NAME: v${{ github.run_id }}-release
run: |
curl -X DELETE \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/git/refs/tags/$TAG_NAME
https://api.github.com/repos/${{ github.repository }}/git/refs/tags/v${{ github.run_id }}-release

- name: Clean Up
run: |
Expand Down
Loading