1
+ name : build italian headless image
2
+
3
+ on :
4
+ workflow_dispatch :
5
+ push :
6
+ branches :
7
+ - dev
8
+ paths :
9
+ - ' .github/workflows/build_img_it.yml'
10
+ - ' build_raspOVOS_it.sh'
11
+ - ' overlays/it/**'
12
+
13
+ jobs :
14
+ # Stage 1: Get Current Date and Release Name
15
+ get-date-release-name :
16
+ runs-on : ubuntu-20.04
17
+ outputs :
18
+ release_name : ${{ steps.current-date.outputs.release_name }}
19
+ cache_key : ${{ steps.current-date.outputs.cache_key }}
20
+ steps :
21
+ - name : Get Current Date and Release Name
22
+ id : current-date
23
+ run : |
24
+ current_date=$(date +'%Y-%m-%d')
25
+ release_name="raspOVOS-italian-bookworm-arm64-lite-${current_date}"
26
+ cache_key="raspOVOS-${{ github.run_id }}"
27
+ echo "release_name=$release_name" >> $GITHUB_OUTPUT
28
+ echo "cache_key=$cache_key" >> $GITHUB_OUTPUT
29
+
30
+ - name : Print outputs
31
+ shell : bash
32
+ run : |
33
+ echo "cache_key: ${{ steps.current-date.outputs.cache_key }}"
34
+ echo "release_name: ${{ steps.current-date.outputs.release_name }}"
35
+
36
+ # Stage 2: Build Image
37
+ modify-rpi-image :
38
+ runs-on : ubuntu-20.04
39
+ needs : get-date-release-name
40
+ outputs :
41
+ image-path : ${{ steps.create-image.outputs.image-path }}
42
+ steps :
43
+ - name : Checkout repository
44
+ uses : actions/checkout@v4
45
+
46
+ - name : Configuring OVOS for Italian
47
+ uses : TigreGotico/rpi-image-modifier@main
48
+ id : create-image
49
+ env :
50
+ USER : ' ovos'
51
+ PASSWORD : ' ovos'
52
+ HOSTNAME : " raspOVOS"
53
+ CONSTRAINTS : " https://github.com/OpenVoiceOS/ovos-releases/raw/refs/heads/main/constraints-alpha.txt"
54
+ with :
55
+ base-image-url : https://github.com/OpenVoiceOS/raspOVOS/releases/download/raspOVOS-DEV-bookworm-arm64-lite-2025-03-13/raspOVOS-DEV-bookworm-arm64-lite.img.xz
56
+ image-path : raspOVOS-italian-bookworm-arm64-lite.img
57
+ compress-with-xz : true
58
+ shrink : true
59
+ cache : false
60
+ mount-repository : true
61
+ env-vars : USER,PASSWORD,HOSTNAME,CONSTRAINTS
62
+ script-path : build_raspOVOS_it.sh
63
+ - name : Print outputs
64
+ shell : bash
65
+ run : |
66
+ echo "image-path: ${{ steps.create-image.outputs.image-path }}"
67
+ echo "image-size: ${{ steps.create-image.outputs.image-size }}"
68
+ echo "image-sha256sum: ${{ steps.create-image.outputs.image-sha256sum }}"
69
+
70
+ - name : Save Image to Cache
71
+ uses : actions/cache@v4
72
+ with :
73
+ path : .
74
+ key : ${{ needs.get-date-release-name.outputs.cache_key }}
75
+
76
+ # Stage 3: Check if Release Exists and Create if Needed
77
+ check-release-or-create :
78
+ runs-on : ubuntu-20.04
79
+ needs : [get-date-release-name, modify-rpi-image]
80
+ outputs :
81
+ release_id : ${{ steps.get-release-id.outputs.release_id }}
82
+ steps :
83
+ - name : Check if Release Exists
84
+ id : get-release-id
85
+ run : |
86
+ release_name="${{ needs.get-date-release-name.outputs.release_name }}"
87
+ release=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
88
+ "https://api.github.com/repos/${{ github.repository }}/releases/tags/$release_name")
89
+ release_id=$(echo $release | jq -r .id)
90
+ if [[ "$release_id" == "null" ]]; then
91
+ release=$(curl -s -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
92
+ -H "Content-Type: application/json" \
93
+ -d "{\"tag_name\":\"$release_name\",\"name\":\"$release_name\",\"body\":\"RaspOVOS pre-configured for English\"}" \
94
+ "https://api.github.com/repos/${{ github.repository }}/releases")
95
+ release_id=$(echo $release | jq -r .id)
96
+ fi
97
+ echo "release_id=$release_id" >> $GITHUB_OUTPUT
98
+
99
+ - name : Print outputs
100
+ shell : bash
101
+ run : |
102
+ echo "release_id: ${{ steps.get-release-id.outputs.release_id }}"
103
+ if [[ $release_id == "null" ]]; then
104
+ echo "Failed to create release. Response: $release"
105
+ exit 1
106
+ fi
107
+
108
+ # Stage 4: Upload to Release
109
+ upload-image :
110
+ runs-on : ubuntu-20.04
111
+ if : ${{ needs.check-release-or-create.outputs.release_id }}
112
+ needs : [modify-rpi-image, check-release-or-create, get-date-release-name]
113
+ steps :
114
+ - name : Restore Cache for Image
115
+ uses : actions/cache@v4
116
+ with :
117
+ path : .
118
+ key : ${{ needs.get-date-release-name.outputs.cache_key }}
119
+ fail-on-cache-miss : true
120
+
121
+ - name : Debug Cache Content
122
+ run : ls .
123
+
124
+ - name : Upload to release
125
+ uses : xresloader/upload-to-github-release@v1
126
+ env :
127
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
128
+ with :
129
+ file : ${{ needs.modify-rpi-image.outputs.image-path }}
130
+ release_id : ${{ needs.check-release-or-create.outputs.release_id }}
131
+ draft : false
132
+ overwrite : true
133
+ prerelease : false
134
+ verbose : true
0 commit comments