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