Skip to content

Commit d8f6566

Browse files
ci: enhance release workflow to trigger and upload ISO artifacts
1 parent e0a6ea1 commit d8f6566

File tree

2 files changed

+47
-64
lines changed

2 files changed

+47
-64
lines changed

.github/workflows/build-and-release.yaml

Lines changed: 20 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ jobs:
1919
build:
2020
runs-on: ubuntu-latest
2121
timeout-minutes: 120 # Set a timeout to prevent hung builds
22+
outputs:
23+
version: ${{ env.VERSION }}
24+
iso_path: ${{ env.WORKSPACE }}/out/arch-linux-no-beeps-${{ env.VERSION }}.iso
2225

2326
steps:
2427
- name: Checkout Repository
@@ -132,70 +135,24 @@ jobs:
132135
done
133136
"
134137
135-
- name: Generate Release Notes
136-
id: release_notes
137-
run: |
138-
# Create a temporary file for release notes
139-
TEMP_RELEASE_NOTES=$(mktemp)
140-
141-
docker exec arch-container bash -c "
142-
set -euo pipefail
143-
cd /workdir
144-
145-
# Initialize release notes
146-
{
147-
echo '🚀 Arch Linux ISO without system beeps (build ${{ env.DATE }})'
148-
echo ''
149-
echo '### Changes'
150-
151-
# Get changes since last release
152-
if git tag | grep -q .; then
153-
LAST_TAG=\$(git describe --tags --abbrev=0 2>/dev/null || echo '')
154-
if [ ! -z \"\$LAST_TAG\" ]; then
155-
echo '#### Commits since last release:'
156-
git log \"\$LAST_TAG\"..HEAD --pretty=format:'- %s' | grep -v 'Merge'
157-
echo ''
158-
fi
159-
fi
160-
161-
# Add standard information
162-
echo '### Features'
163-
echo '- Automatic daily build'
164-
echo '- System beeps disabled'
165-
echo '- ISO SHA256 and SHA512 checksums included'
166-
echo ''
167-
echo '### Download'
168-
echo '- Download the ISO and verify checksums before use'
169-
echo ''
170-
echo '### Checksums'
171-
echo 'SHA256 and SHA512 checksums are available in the uploaded files.'
172-
} > /tmp/release_notes
173-
"
174-
175-
# Copy release notes from container to host
176-
docker cp arch-container:/tmp/release_notes $TEMP_RELEASE_NOTES
177-
178-
# Set the release notes in GITHUB_ENV
179-
echo 'RELEASE_NOTES<<EOF' >> $GITHUB_ENV
180-
cat $TEMP_RELEASE_NOTES >> $GITHUB_ENV
181-
echo 'EOF' >> $GITHUB_ENV
182-
183-
# Cleanup
184-
rm -f $TEMP_RELEASE_NOTES
185-
186-
- name: Create Release
187-
id: create_release
188-
uses: softprops/action-gh-release@v1
189-
if: github.ref == 'refs/heads/main'
138+
- name: Trigger Release Workflow
139+
if: success()
140+
uses: peter-evans/repository-dispatch@v2
141+
with:
142+
token: ${{ secrets.GITHUB_TOKEN }}
143+
event-type: trigger-release
144+
client-payload: '{"version": "${{ env.VERSION }}", "iso_path": "out/arch-linux-no-beeps-${{ env.VERSION }}.iso"}'
145+
146+
- name: Upload ISO Artifacts
147+
if: success()
148+
uses: actions/upload-artifact@v4
190149
with:
191-
tag_name: v${{ env.VERSION }}
192-
name: "Arch Linux No Beeps v${{ env.VERSION }}"
193-
body: ${{ env.RELEASE_NOTES }}
194-
draft: false
195-
prerelease: false
196-
files: |
197-
${{ env.WORKSPACE }}/out/*.iso
198-
${{ env.WORKSPACE }}/out/*.sha*sum
150+
name: iso-files
151+
path: |
152+
out/arch-linux-no-beeps-${{ env.VERSION }}.iso
153+
out/arch-linux-no-beeps-${{ env.VERSION }}.iso.sha256sum
154+
out/arch-linux-no-beeps-${{ env.VERSION }}.iso.sha512sum
155+
retention-days: 1
199156

200157
- name: Clean Up
201158
if: always()

.github/workflows/create-release.yaml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Create/Update Release
22

33
on:
4+
repository_dispatch:
5+
types: [trigger-release]
46
push:
57
branches:
68
- main
@@ -81,7 +83,31 @@ jobs:
8183
--title "Release ${{ env.VERSION }}" \
8284
--notes-file release_notes.md \
8385
--target ${GITHUB_REF#refs/heads/}
84-
fi
86+
87+
- name: Download ISO Artifacts
88+
uses: actions/download-artifact@v4
89+
with:
90+
name: iso-files
91+
path: ./iso-files
92+
93+
- name: Update Release with ISO
94+
env:
95+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
96+
run: |
97+
# Check if release exists
98+
if gh release view "${{ env.VERSION }}" &>/dev/null; then
99+
# Update existing release and upload ISO
100+
gh release edit "${{ env.VERSION }}" \
101+
--title "Release ${{ env.VERSION }}" \
102+
--notes-file release_notes.md
103+
gh release upload "${{ env.VERSION }}" ./iso-files/*
104+
else
105+
# Create new release with ISO
106+
gh release create "${{ env.VERSION }}" \
107+
--title "Release ${{ env.VERSION }}" \
108+
--notes-file release_notes.md \
109+
--target ${GITHUB_REF#refs/heads/} \
110+
./iso-files/*
85111
86112
- name: Upload Build Logs
87113
if: always()

0 commit comments

Comments
 (0)