Skip to content

Commit c1246c1

Browse files
committed
wip: Add deploy workflow
Signed-off-by: Pawel Langowski <pawel.langowski@3mdeb.com>
1 parent 1cbcd54 commit c1246c1

File tree

1 file changed

+241
-0
lines changed

1 file changed

+241
-0
lines changed

.github/workflows/deploy.yml

+241
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,241 @@
1+
name: Deploy
2+
on:
3+
push:
4+
tags:
5+
- '*'
6+
7+
jobs:
8+
deploy_protectli:
9+
runs-on: ubuntu-22.04
10+
if: contains(github.ref, 'refs/tags/protectli')
11+
strategy:
12+
matrix:
13+
vendor: [ protectli ]
14+
model: [ vp66xx, vp46xx, vp2420, vp2410, V1210, V1211, V1410, V1610 ]
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Checkout all submodules
20+
run: git submodule update --init --recursive --checkout
21+
22+
- name: Set up tag name
23+
id: tag_name
24+
run: echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
25+
26+
- name: Parse directories from tag
27+
id: parse_directories
28+
run: |
29+
tag=${{ steps.tag_name.outputs.tag }}
30+
base_dir="protectli"
31+
model=$(echo "$tag" | cut -d'_' -f1-3)
32+
release=$(echo "$tag" | cut -d'_' -f4)
33+
echo "base_dir=$base_dir" >> "$GITHUB_OUTPUT"
34+
echo "model=$model" >> "$GITHUB_OUTPUT"
35+
echo "release=$release" >> "$GITHUB_OUTPUT"
36+
37+
# Allows downloading artifacts from a different workflow
38+
- name: Download workflow artifact
39+
uses: dawidd6/action-download-artifact@v6
40+
with:
41+
workflow: build.yml
42+
name: "dasharo-${{ matrix.vendor }}-${{ matrix.model }}"
43+
path: "./artifacts"
44+
45+
- name: Upload to Nextcloud
46+
env:
47+
CLOUD_URL: ${{ secrets.CLOUD_URL }}
48+
CLOUD_PASSWORD: ${{ secrets.CLOUD_PASSWORD }}
49+
run: |
50+
BASE_URL="https://cloud.3mdeb.com/public.php/webdav"
51+
url_part=$(echo "$CLOUD_URL" | cut -d'/' -f6)
52+
base_dir="${{ steps.parse_directories.outputs.base_dir }}"
53+
model="${{ steps.parse_directories.outputs.model }}"
54+
release="${{ steps.parse_directories.outputs.release }}"
55+
CURL_CMD="curl -u $url_part:$CLOUD_PASSWORD"
56+
57+
new_name=$(echo "${{ matrix.vendor }}-${{ matrix.model }}.rom" | sed 's/-/_/g; s/.*/\L&/')
58+
59+
# Create release directory if it doesn't exist
60+
$CURL_CMD -X MKCOL "$BASE_URL/$base_dir/$model/$release"
61+
$CURL_CMD -X PUT -T "artifacts/coreboot.rom" "$BASE_URL/$base_dir/$model/$release/$new_name"
62+
sha256sum artifacts/coreboot.rom > ${new_name}.sha256
63+
$CURL_CMD -X PUT -T "${new_name}.sha256" "$BASE_URL/$base_dir/$model/$release/"
64+
65+
deploy_novacustom:
66+
runs-on: ubuntu-22.04
67+
if: contains(github.ref, 'refs/tags/novacustom')
68+
69+
steps:
70+
- name: Checkout repository
71+
uses: actions/checkout@v4
72+
73+
- name: Checkout all submodules
74+
run: git submodule update --init --recursive --checkout
75+
76+
- name: Set up tag name
77+
id: tag_name
78+
run: echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
79+
80+
- name: Parse directories from tag
81+
id: parse_directories
82+
run: |
83+
tag=${{ steps.tag_name.outputs.tag }}
84+
base_dir="novacustom"
85+
model=$(echo "$tag" | cut -d'_' -f1-3)
86+
release=$(echo "$tag" | cut -d'_' -f4)
87+
echo "base_dir=$base_dir" >> "$GITHUB_OUTPUT"
88+
echo "model=$model" >> "$GITHUB_OUTPUT"
89+
echo "release=$release" >> "$GITHUB_OUTPUT"
90+
91+
- name: Parse artifact name
92+
id: artifact_name
93+
run: |
94+
first_part=$(echo ${{ steps.tag_name.outputs.tag }} | cut -d "_" -f1)
95+
second_part=$(echo ${{ steps.tag_name.outputs.tag }} | cut -d "_" -f2-3)
96+
echo "artifact_name=dasharo-$first_part-$second_part" >> "$GITHUB_OUTPUT"
97+
98+
# Allows downloading artifacts from a different workflow
99+
- name: Download workflow artifact
100+
uses: dawidd6/action-download-artifact@v6
101+
with:
102+
workflow: build.yml
103+
name: ${{ steps.artifact_name.outputs.artifact_name }}
104+
path: "./artifacts"
105+
106+
- name: Upload to Nextcloud
107+
env:
108+
CLOUD_URL: ${{ secrets.CLOUD_URL }}
109+
CLOUD_PASSWORD: ${{ secrets.CLOUD_PASSWORD }}
110+
run: |
111+
BASE_URL="https://cloud.3mdeb.com/public.php/webdav"
112+
url_part=$(echo "$CLOUD_URL" | cut -d'/' -f6)
113+
base_dir="${{ steps.parse_directories.outputs.base_dir }}"
114+
model="${{ steps.parse_directories.outputs.model }}"
115+
release="${{ steps.parse_directories.outputs.release }}"
116+
CURL_CMD="curl -u $url_part:$CLOUD_PASSWORD"
117+
118+
new_name=$(echo "${model}_${release}.rom" | sed 's/-/_/g; s/.*/\L&/')
119+
120+
# Create release directory if it doesn't exist
121+
$CURL_CMD -X MKCOL "$BASE_URL/$base_dir/$model/$release"
122+
$CURL_CMD -X PUT -T "artifacts/coreboot.rom" "$BASE_URL/$base_dir/$model/$release/$new_name"
123+
sha256sum artifacts/coreboot.rom > ${new_name}.sha256
124+
$CURL_CMD -X PUT -T "${new_name}.sha256" "$BASE_URL/$base_dir/$model/$release/"
125+
deploy_pcengines:
126+
runs-on: ubuntu-22.04
127+
if: contains(github.ref, 'refs/tags/pcengines')
128+
strategy:
129+
matrix:
130+
vendor: [ pcengines ]
131+
model: [ apu2, apu3, apu4, apu6 ]
132+
payload: [ uefi ]
133+
steps:
134+
- name: Checkout repository
135+
uses: actions/checkout@v4
136+
137+
- name: Checkout all submodules
138+
run: git submodule update --init --recursive --checkout
139+
140+
- name: Set up tag name
141+
id: tag_name
142+
run: echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
143+
144+
- name: Parse directories from tag
145+
id: parse_directories
146+
run: |
147+
tag=${{ steps.tag_name.outputs.tag }}
148+
base_dir="pcengines"
149+
release=$(echo "$tag" | cut -d'_' -f3)
150+
echo "base_dir=$base_dir" >> "$GITHUB_OUTPUT"
151+
echo "release=$release" >> "$GITHUB_OUTPUT"
152+
153+
# Allows downloading artifacts from a different workflow
154+
- name: Download workflow artifact
155+
uses: dawidd6/action-download-artifact@v6
156+
with:
157+
workflow: build.yml
158+
name: "dasharo-${{ matrix.vendor }}-${{ matrix.model }}-${{ matrix.payload }}"
159+
path: "./artifacts"
160+
161+
- name: Upload to Nextcloud
162+
env:
163+
CLOUD_URL: ${{ secrets.CLOUD_URL }}
164+
CLOUD_PASSWORD: ${{ secrets.CLOUD_PASSWORD }}
165+
run: |
166+
BASE_URL="https://cloud.3mdeb.com/public.php/webdav"
167+
url_part=$(echo "$CLOUD_URL" | cut -d'/' -f6)
168+
base_dir="${{ steps.parse_directories.outputs.base_dir }}"
169+
release="${{ steps.parse_directories.outputs.release }}"
170+
CURL_CMD="curl -u $url_part:$CLOUD_PASSWORD"
171+
172+
new_name=$(echo "${{ matrix.vendor }}_${{ matrix.model }}_${{ matrix.payload }}_${release}.rom" | sed 's/.*/\L&/')
173+
174+
# Create release directory if it doesn't exist
175+
$CURL_CMD -X MKCOL "$BASE_URL/$base_dir/pcengines_apu2/$release"
176+
$CURL_CMD -X PUT -T "artifacts/coreboot.rom" "$BASE_URL/$base_dir/pcengines_apu2/$release/$new_name"
177+
sha256sum artifacts/coreboot.rom > ${new_name}.sha256
178+
$CURL_CMD -X PUT -T "${new_name}.sha256" "$BASE_URL/$base_dir/pcengines_apu2/$release/"
179+
180+
deploy_msi:
181+
runs-on: ubuntu-22.04
182+
if: contains(github.ref, 'refs/tags/msi')
183+
strategy:
184+
matrix:
185+
type: [ ddr4, ddr5 ]
186+
steps:
187+
- name: Checkout repository
188+
uses: actions/checkout@v4
189+
190+
- name: Checkout all submodules
191+
run: git submodule update --init --recursive --checkout
192+
193+
- name: Set up tag name
194+
id: tag_name
195+
run: echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
196+
197+
- name: Parse directories from tag
198+
id: parse_directories
199+
run: |
200+
tag=${{ steps.tag_name.outputs.tag }}
201+
base_dir="msi"
202+
model=$(echo "$tag" | cut -d'_' -f1-2)
203+
release=$(echo "$tag" | cut -d'_' -f3)
204+
echo "base_dir=$base_dir" >> "$GITHUB_OUTPUT"
205+
echo "model=$model" >> "$GITHUB_OUTPUT"
206+
echo "release=$release" >> "$GITHUB_OUTPUT"
207+
208+
- name: Parse artifact name
209+
id: artifact_name
210+
run: |
211+
first_part=$(echo ${{ steps.tag_name.outputs.tag }} | cut -d "_" -f1)
212+
second_part=$(echo ${{ steps.tag_name.outputs.tag }} | cut -d "_" -f2)
213+
echo "artifact_name=dasharo-$first_part-${second_part}_${{ matrix.type }}" >> "$GITHUB_OUTPUT"
214+
215+
# Allows downloading artifacts from a different workflow
216+
- name: Download workflow artifact
217+
uses: dawidd6/action-download-artifact@v6
218+
with:
219+
workflow: build.yml
220+
name: ${{ steps.artifact_name.outputs.artifact_name }}
221+
path: "./artifacts"
222+
223+
- name: Upload to Nextcloud
224+
env:
225+
CLOUD_URL: ${{ secrets.CLOUD_URL }}
226+
CLOUD_PASSWORD: ${{ secrets.CLOUD_PASSWORD }}
227+
run: |
228+
BASE_URL="https://cloud.3mdeb.com/public.php/webdav"
229+
url_part=$(echo "$CLOUD_URL" | cut -d'/' -f6)
230+
base_dir="${{ steps.parse_directories.outputs.base_dir }}"
231+
model="${{ steps.parse_directories.outputs.model }}"
232+
release="${{ steps.parse_directories.outputs.release }}"
233+
CURL_CMD="curl -u $url_part:$CLOUD_PASSWORD"
234+
235+
new_name=$(echo "${model}_${{ matrix.type }}_${release}.rom" | sed 's/-/_/g; s/.*/\L&/')
236+
237+
# Create release directory if it doesn't exist
238+
$CURL_CMD -X MKCOL "$BASE_URL/$base_dir/$model/$release"
239+
$CURL_CMD -X PUT -T "artifacts/coreboot.rom" "$BASE_URL/$base_dir/$model/$release/$new_name"
240+
sha256sum artifacts/coreboot.rom > ${new_name}.sha256
241+
$CURL_CMD -X PUT -T "${new_name}.sha256" "$BASE_URL/$base_dir/$model/$release/"

0 commit comments

Comments
 (0)