wip: Add deploy workflow #5
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy | ||
on: | ||
push: | ||
tags: | ||
- '*' | ||
jobs: | ||
deploy_protectli: | ||
runs-on: ubuntu-22.04 | ||
if: contains(github.ref, 'refs/tags/protectli') | ||
strategy: | ||
matrix: | ||
vendor: [ protectli ] | ||
model: [ vp66xx, vp46xx, vp2420, vp2410, V1210, V1211, V1410, V1610 ] | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Checkout all submodules | ||
run: git submodule update --init --recursive --checkout | ||
- name: Set up tag name | ||
id: tag_name | ||
run: echo "::set-output name=tag::${GITHUB_REF#refs/tags/}" | ||
- name: Parse directories from tag | ||
id: parse_directories | ||
run: | | ||
tag=${{ steps.tag_name.outputs.tag }} | ||
base_dir="protectli" | ||
model=$(echo "$tag" | cut -d'_' -f1-3) | ||
release=$(echo "$tag" | cut -d'_' -f4) | ||
echo "::set-output name=base_dir::$base_dir" | ||
echo "::set-output name=model::$model" | ||
echo "::set-output name=release::$release" | ||
# Allows downloading artifacts from a different workflow | ||
- name: Download workflow artifact | ||
uses: dawidd6/action-download-artifact@v6 | ||
workflow: build.yml | ||
Check failure on line 40 in .github/workflows/deploy.yml
|
||
name: "dasharo-${{ matrix.vendor }}-${{ matrix.model }}" | ||
path: "./artifacts" | ||
- name: Upload to Nextcloud | ||
env: | ||
CLOUD_URL: ${{ secrets.CLOUD_URL }} | ||
CLOUD_PASSWORD: ${{ secrets.CLOUD_PASSWORD }} | ||
run: | | ||
BASE_URL="https://cloud.3mdeb.com/public.php/webdav" | ||
HEADER="X-Requested-With: XMLHttpRequest" | ||
CURL_CMD="curl -u $url_part:$CLOUD_PASSWORD -H $HEADER" | ||
base_dir="${{ steps.parse_directories.outputs.base_dir }}" | ||
model="${{ steps.parse_directories.outputs.model }}" | ||
release="${{ steps.parse_directories.outputs.release }}" | ||
url_part=$(echo "$CLOUD_URL" | cut -d'/' -f6) | ||
# Create release directory if it doesn't exist | ||
$CURL_CMD -X MKCOL "$BASE_URL/$base_dir/$model/$release" | ||
$CURL_CMD -X PUT -T "dasharo-${{ matrix.vendor }}-${{ matrix.model }}" "$CLOUD_URL/$base_dir/$model/$release/" |