Skip to content

Commit beff22d

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

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

.github/workflows/deploy.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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 "::set-output name=tag::${GITHUB_REF#refs/tags/}"
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 "::set-output name=base_dir::$base_dir"
34+
echo "::set-output name=model::$model"
35+
echo "::set-output name=release::$release"
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+
HEADER="X-Requested-With: XMLHttpRequest"
52+
CURL_CMD="curl -u $url_part:$CLOUD_PASSWORD -H $HEADER"
53+
base_dir="${{ steps.parse_directories.outputs.base_dir }}"
54+
model="${{ steps.parse_directories.outputs.model }}"
55+
release="${{ steps.parse_directories.outputs.release }}"
56+
url_part=$(echo "$CLOUD_URL" | cut -d'/' -f6)
57+
# Create release directory if it doesn't exist
58+
$CURL_CMD -X MKCOL "$BASE_URL/$base_dir/$model/$release"
59+
$CURL_CMD -X PUT -T "dasharo-${{ matrix.vendor }}-${{ matrix.model }}" "$CLOUD_URL/$base_dir/$model/$release/"

0 commit comments

Comments
 (0)