Skip to content

Commit 974e17f

Browse files
Refactor release notes generation in GitHub Actions workflow for Arch Linux ISO builds
- Create temporary file for release notes within the Docker container. - Streamline the process of generating release notes by capturing output directly to a temporary file. - Ensure release notes are copied from the container to the host and set in GITHUB_ENV. - Maintain structured content for features, download instructions, and checksum information.
1 parent ec6fefa commit 974e17f

File tree

1 file changed

+40
-26
lines changed

1 file changed

+40
-26
lines changed

.github/workflows/build.yaml

Lines changed: 40 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -136,39 +136,53 @@ jobs:
136136
- name: Generate Release Notes
137137
id: release_notes
138138
run: |
139+
# Create a temporary file for release notes
140+
TEMP_RELEASE_NOTES=$(mktemp)
141+
139142
docker exec arch-container bash -c "
140143
set -euo pipefail
141144
cd /workdir
142145
143146
# Initialize release notes
144-
echo 'RELEASE_NOTES<<EOF' >> \$GITHUB_ENV
145-
echo '🚀 Arch Linux ISO without system beeps (build ${{ env.DATE }})' >> \$GITHUB_ENV
146-
echo '' >> \$GITHUB_ENV
147-
echo '### Changes' >> \$GITHUB_ENV
148-
149-
# Get changes since last release
150-
if git tag | grep -q .; then
151-
LAST_TAG=\$(git describe --tags --abbrev=0 2>/dev/null || echo '')
152-
if [ ! -z \"\$LAST_TAG\" ]; then
153-
echo '#### Commits since last release:' >> \$GITHUB_ENV
154-
git log \"\$LAST_TAG\"..HEAD --pretty=format:'- %s' | grep -v 'Merge' >> \$GITHUB_ENV
155-
echo '' >> \$GITHUB_ENV
147+
{
148+
echo '🚀 Arch Linux ISO without system beeps (build ${{ env.DATE }})'
149+
echo ''
150+
echo '### Changes'
151+
152+
# Get changes since last release
153+
if git tag | grep -q .; then
154+
LAST_TAG=\$(git describe --tags --abbrev=0 2>/dev/null || echo '')
155+
if [ ! -z \"\$LAST_TAG\" ]; then
156+
echo '#### Commits since last release:'
157+
git log \"\$LAST_TAG\"..HEAD --pretty=format:'- %s' | grep -v 'Merge'
158+
echo ''
159+
fi
156160
fi
157-
fi
158-
159-
# Add standard information
160-
echo '### Features' >> \$GITHUB_ENV
161-
echo '- Automatic daily build' >> \$GITHUB_ENV
162-
echo '- System beeps disabled' >> \$GITHUB_ENV
163-
echo '- ISO SHA256 and SHA512 checksums included' >> \$GITHUB_ENV
164-
echo '' >> \$GITHUB_ENV
165-
echo '### Download' >> \$GITHUB_ENV
166-
echo '- Download the ISO and verify checksums before use' >> \$GITHUB_ENV
167-
echo '' >> \$GITHUB_ENV
168-
echo '### Checksums' >> \$GITHUB_ENV
169-
echo 'SHA256 and SHA512 checksums are available in the uploaded files.' >> \$GITHUB_ENV
170-
echo 'EOF' >> \$GITHUB_ENV
161+
162+
# Add standard information
163+
echo '### Features'
164+
echo '- Automatic daily build'
165+
echo '- System beeps disabled'
166+
echo '- ISO SHA256 and SHA512 checksums included'
167+
echo ''
168+
echo '### Download'
169+
echo '- Download the ISO and verify checksums before use'
170+
echo ''
171+
echo '### Checksums'
172+
echo 'SHA256 and SHA512 checksums are available in the uploaded files.'
173+
} > /tmp/release_notes
171174
"
175+
176+
# Copy release notes from container to host
177+
docker cp arch-container:/tmp/release_notes $TEMP_RELEASE_NOTES
178+
179+
# Set the release notes in GITHUB_ENV
180+
echo 'RELEASE_NOTES<<EOF' >> $GITHUB_ENV
181+
cat $TEMP_RELEASE_NOTES >> $GITHUB_ENV
182+
echo 'EOF' >> $GITHUB_ENV
183+
184+
# Cleanup
185+
rm -f $TEMP_RELEASE_NOTES
172186
173187
- name: Create Release
174188
id: create_release

0 commit comments

Comments
 (0)