mirror of
https://github.com/Dasharo/coreboot.git
synced 2026-03-06 14:43:26 -08:00
122 lines
4.0 KiB
YAML
122 lines
4.0 KiB
YAML
name: Reusable Deploy workflow
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
platform:
|
|
type: string
|
|
vendor:
|
|
type: string
|
|
required: false
|
|
model:
|
|
type: string
|
|
required: false
|
|
payload:
|
|
type: string
|
|
required: false
|
|
type:
|
|
type: string
|
|
required: false
|
|
artifact_name:
|
|
type: string
|
|
# Set to true for DPP/community releases by 3mdeb
|
|
released_by_3mdeb:
|
|
type: boolean
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up tag name
|
|
id: tag_name
|
|
run: echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Parse directories
|
|
id: parse_directories
|
|
run: |
|
|
|
|
tag=${{ steps.tag_name.outputs.tag }}
|
|
# Extract platform model string (everything before the last underscore in the tag)
|
|
model=$(echo "$tag" | awk -F'_' '{OFS="_"; $(NF)=""; print $0}' | sed 's/_$//')
|
|
# Extract version string (everything after the last underscore in the tag)
|
|
release=$(echo "$tag" | awk -F'_' '{print $NF}')
|
|
|
|
# Use 3mdeb directory for community / DPP releases
|
|
if ${{ inputs.released_by_3mdeb }} ; then
|
|
base_dir="3mdeb"
|
|
else
|
|
# by default, use platform vendor name as a directory
|
|
base_dir="${{ inputs.platform }}"
|
|
fi
|
|
|
|
echo "base_dir=$base_dir" >> "$GITHUB_OUTPUT"
|
|
echo "model=$model" >> "$GITHUB_OUTPUT"
|
|
echo "release=$release" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Download workflow artifact
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: ${{ inputs.artifact_name }}
|
|
path: "./artifacts"
|
|
|
|
- name: Upload to Nextcloud
|
|
run: |
|
|
BASE_URL="https://cloud.3mdeb.com/public.php/webdav"
|
|
url_part=$(echo "${{ secrets.CLOUD_URL }}" | cut -d'/' -f6)
|
|
base_dir="${{ steps.parse_directories.outputs.base_dir }}"
|
|
model="${{ steps.parse_directories.outputs.model }}"
|
|
release="${{ steps.parse_directories.outputs.release }}"
|
|
CURL_CMD="curl -u $url_part:${{ secrets.CLOUD_PASSWORD }}"
|
|
|
|
case "$model" in
|
|
*vp2430*|*vp2440*|*vp3230*|*3210*)
|
|
subdir="$model"
|
|
model="protectli_adln"
|
|
;;
|
|
*)
|
|
subdir=""
|
|
;;
|
|
esac
|
|
|
|
if [ "${{ inputs.platform }}" == "pcengines" ]; then
|
|
new_name="pcengines_${{ inputs.model }}_${release}.rom"
|
|
else
|
|
new_name="${{ inputs.model }}_${release}.rom"
|
|
if [ ! -z "${{ inputs.vendor }}" ]; then
|
|
new_name="${{ inputs.vendor }}_${new_name}"
|
|
fi
|
|
if [ ! -z "${{ inputs.payload }}" ]; then
|
|
new_name=$(echo "$new_name" | awk -F'_' '{OFS="_"; $NF="${{ inputs.payload }}_"$NF; print}')
|
|
fi
|
|
if [ ! -z "${{ inputs.type }}" ]; then
|
|
new_name=$(echo "${new_name%.rom}_${{ inputs.type }}.rom")
|
|
fi
|
|
fi
|
|
|
|
# Prepare cloud path
|
|
|
|
if [[ "$model" == *adln* ]]; then
|
|
# If subdir is empty, assign default
|
|
if [[ -z "$subdir" ]]; then
|
|
subdir="protectli_vp32xx"
|
|
fi
|
|
path="$base_dir/$model/$subdir/$release"
|
|
else
|
|
path="$base_dir/$model/$release"
|
|
fi
|
|
|
|
# Create release directory if it doesn't exist recursively
|
|
IFS='/' read -ra DIRS <<< "$path"
|
|
current=""
|
|
for part in "${DIRS[@]}"; do
|
|
current="${current:+$current/}$part"
|
|
$CURL_CMD -X MKCOL "$BASE_URL/$current" || true
|
|
done
|
|
|
|
# upload firmware and hash files
|
|
$CURL_CMD -X PUT -T "artifacts/coreboot.rom" "$BASE_URL/$base_dir/$model/$release/$new_name"
|
|
sha256sum artifacts/coreboot.rom > ${new_name}.sha256
|
|
$CURL_CMD -X PUT -T "${new_name}.sha256" "$BASE_URL/$base_dir/$model/$release/"
|