Skip to content

Commit 1bed21a

Browse files
ci: refactor release workflow to use workflow_run and improve artifact retention
1 parent c7ce90c commit 1bed21a

File tree

2 files changed

+29
-11
lines changed

2 files changed

+29
-11
lines changed

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

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,6 @@ jobs:
135135
done
136136
"
137137
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-
146138
- name: Upload ISO Artifacts
147139
if: success()
148140
uses: actions/upload-artifact@v4
@@ -152,7 +144,14 @@ jobs:
152144
out/arch-linux-no-beeps-${{ env.VERSION }}.iso
153145
out/arch-linux-no-beeps-${{ env.VERSION }}.iso.sha256sum
154146
out/arch-linux-no-beeps-${{ env.VERSION }}.iso.sha512sum
155-
retention-days: 1
147+
retention-days: 2 # Verhoog retentie voor workflow_run
148+
if-no-files-found: error
149+
150+
# Verwijder de repository_dispatch trigger omdat we workflow_run gebruiken
151+
- name: Trigger Release Workflow
152+
if: success()
153+
run: |
154+
echo "Build workflow completed successfully. Release workflow will be triggered automatically."
156155
157156
- name: Clean Up
158157
if: always()

.github/workflows/create-release.yaml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
name: Create/Update Release
22

33
on:
4-
repository_dispatch:
5-
types: [trigger-release]
4+
workflow_run:
5+
workflows: ["Build ISO"]
6+
types:
7+
- completed
8+
branches:
9+
- main
610
push:
711
branches:
812
- main
@@ -19,9 +23,12 @@ permissions:
1923

2024
jobs:
2125
update-release:
26+
# Alleen uitvoeren als de build succesvol was
27+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
2228
runs-on: ubuntu-latest
2329
permissions:
2430
contents: write
31+
issues: write
2532

2633
steps:
2734
- name: Checkout Repository
@@ -97,6 +104,18 @@ jobs:
97104
with:
98105
name: iso-files
99106
path: ./iso-files
107+
github-token: ${{ secrets.GITHUB_TOKEN }}
108+
run-id: ${{ github.event.workflow_run.id }}
109+
repository: ${{ github.repository }}
110+
111+
- name: Verify ISO Files
112+
run: |
113+
if [ ! -d "./iso-files" ] || [ -z "$(ls -A ./iso-files)" ]; then
114+
echo "::error::ISO files not found in artifacts"
115+
exit 1
116+
fi
117+
echo "Found ISO files:"
118+
ls -la ./iso-files/
100119
101120
- name: Update Release with ISO
102121
env:

0 commit comments

Comments
 (0)