Skip to content

Commit

Permalink
wip: simplify workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Pawel Langowski <[email protected]>
  • Loading branch information
PLangowski committed Oct 3, 2024
1 parent b7b3691 commit f1aec3f
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 33 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ jobs:
platform: protectli
vendor: ${{ matrix.vendor }}
model: ${{ matrix.model }}
artifact_name: "dasharo-${{ matrix.vendor }}-${{ matrix.model }}"

secrets: inherit
strategy:
matrix:
Expand All @@ -278,6 +280,7 @@ jobs:
platform: protectli
vendor: ${{ matrix.vendor }}
model: ${{ matrix.model }}
artifact_name: "dasharo-${{ matrix.vendor }}-${{ matrix.model }}"
secrets: inherit
strategy:
matrix:
Expand All @@ -291,6 +294,7 @@ jobs:
platform: protectli
vendor: ${{ matrix.vendor }}
model: ${{ matrix.model }}
artifact_name: "dasharo-${{ matrix.vendor }}-${{ matrix.model }}"
secrets: inherit
strategy:
matrix:
Expand All @@ -304,6 +308,7 @@ jobs:
platform: protectli
vendor: ${{ matrix.vendor }}
model: ${{ matrix.model }}
artifact_name: "dasharo-${{ matrix.vendor }}-${{ matrix.model }}"
secrets: inherit
strategy:
matrix:
Expand All @@ -317,6 +322,7 @@ jobs:
platform: protectli
vendor: ${{ matrix.vendor }}
model: ${{ matrix.model }}
artifact_name: "dasharo-${{ matrix.vendor }}-${{ matrix.model }}"
secrets: inherit
strategy:
matrix:
Expand All @@ -328,7 +334,12 @@ jobs:
uses: ./.github/workflows/deploy-template.yml
with:
platform: novacustom
artifact_name: "dasharo-${{ matrix.vendor }}-${{ matrix.model }}"
secrets: inherit
strategy:
matrix:
vendor: [ novacustom ]
model: [ nv4x_adl, ns5x_adl, nv4x_tgl, ns5x_tgl ]
deploy_pcengines:
if: startsWith(github.ref, 'refs/tags/pcengines')
needs: build_pcengines
Expand All @@ -338,6 +349,7 @@ jobs:
vendor: ${{ matrix.vendor }}
model: ${{ matrix.model }}
payload: ${{ matrix.payload }}
artifact_name: "dasharo-${{ matrix.vendor }}-${{ matrix.model }}-${{ matrix.payload }}"
secrets: inherit
strategy:
matrix:
Expand All @@ -351,20 +363,22 @@ jobs:
with:
platform: msi
type: ${{ matrix.type }}
artifact_name: "dasharo-${{ matrix.vendor }}-${{ matrix.model }}"
secrets: inherit
strategy:
matrix:
vendor: [ msi ]
type: [ ddr4, ddr5 ]
model: [ ms7d25_ddr4, ms7d25_ddr5, ms7e06_ddr4, ms7e06_ddr5 ]
deploy_hardkernel_odroid:
if: startsWith(github.ref, 'refs/tags/hardkernel_odroid_h4')
needs: build_hardkernel_odroid_h4
uses: ./.github/workflows/deploy-template.yml
with:
platform: hardkernel
vendor: ${{ matrix.vendor }}
model: ${{ matrix.model }}
artifact_name: "dasharo-${{ matrix.vendor }}-${{ matrix.model }}"
secrets: inherit
strategy:
matrix:
vendor: [ hardkernel ]
model: [ odroid_h4 ]
model: [ odroid_h4 ]
58 changes: 28 additions & 30 deletions .github/workflows/deploy-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ on:
type:
type: string
required: false
artifact_name:
type: string

jobs:
deploy:
Expand Down Expand Up @@ -53,29 +55,10 @@ jobs:
echo "model=$model" >> "$GITHUB_OUTPUT"
echo "release=$release" >> "$GITHUB_OUTPUT"
- name: Parse artifact name
id: artifact_name
run: |
if [ "${{ inputs.platform }}" == "protectli" ]; then
echo "artifact_name=dasharo-${{ inputs.vendor }}-${{ inputs.model }}" >> "$GITHUB_OUTPUT"
elif [ "${{ inputs.platform }}" == "novacustom" ]; then
first_part=$(echo ${{ steps.tag_name.outputs.tag }} | cut -d "_" -f1)
second_part=$(echo ${{ steps.tag_name.outputs.tag }} | cut -d "_" -f2-3)
echo "artifact_name=dasharo-$first_part-$second_part" >> "$GITHUB_OUTPUT"
elif [ "${{ inputs.platform }}" == "pcengines" ]; then
echo "artifact_name=dasharo-${{ inputs.vendor }}-${{ inputs.model }}-${{ inputs.payload }}" >> "$GITHUB_OUTPUT"
elif [ "${{ inputs.platform }}" == "msi" ]; then
first_part=$(echo ${{ steps.tag_name.outputs.tag }} | cut -d "_" -f1)
second_part=$(echo ${{ steps.tag_name.outputs.tag }} | cut -d "_" -f2)
echo "artifact_name=dasharo-$first_part-${second_part}_${{ inputs.type }}" >> "$GITHUB_OUTPUT"
elif [ "${{ inputs.platform }}" == "hardkernel" ]; then
echo "artifact_name=dasharo-${{ inputs.vendor }}-${{ inputs.model }}" >> "$GITHUB_OUTPUT"
fi
- name: Download workflow artifact
uses: actions/download-artifact@v4
with:
name: ${{ steps.artifact_name.outputs.artifact_name }}
name: ${{ inputs.artifact_name }}
path: "./artifacts"

- name: Upload to Nextcloud
Expand All @@ -87,16 +70,31 @@ jobs:
release="${{ steps.parse_directories.outputs.release }}"
CURL_CMD="curl -u $url_part:${{ secrets.CLOUD_PASSWORD }}"
if [ "${{ inputs.platform }}" == "protectli" ]; then
new_name=$(echo "${{ inputs.vendor }}-${{ inputs.model }}.rom" | sed 's/-/_/g; s/.*/\L&/')
elif [ "${{ inputs.platform }}" == "novacustom" ]; then
new_name=$(echo "${model}_${release}.rom" | sed 's/-/_/g; s/.*/\L&/')
elif [ "${{ inputs.platform }}" == "pcengines" ]; then
new_name=$(echo "${{ inputs.vendor }}_${{ inputs.model }}_${{ inputs.payload }}_${release}.rom" | sed 's/.*/\L&/')
elif [ "${{ inputs.platform }}" == "msi" ]; then
new_name=$(echo "${model}_${{ inputs.type }}_${release}.rom" | sed 's/-/_/g; s/.*/\L&/')
elif [ "${{ inputs.platform }}" == "hardkernel" ]; then
new_name=$(echo "${{ inputs.vendor }}-${{ inputs.model }}_${release}.rom" | sed 's/-/_/g; s/.*/\L&/')
# if [ "${{ inputs.platform }}" == "protectli" ]; then
# new_name=$(echo "${{ inputs.vendor }}-${{ inputs.model }}.rom" | sed 's/-/_/g; s/.*/\L&/')
# elif [ "${{ inputs.platform }}" == "novacustom" ]; then
# new_name=$(echo "${model}_${release}.rom" | sed 's/-/_/g; s/.*/\L&/')
# elif [ "${{ inputs.platform }}" == "pcengines" ]; then
# new_name=$(echo "${{ inputs.vendor }}_${{ inputs.model }}_${{ inputs.payload }}_${release}.rom" | sed 's/.*/\L&/')
# elif [ "${{ inputs.platform }}" == "msi" ]; then
# new_name=$(echo "${model}_${{ inputs.type }}_${release}.rom" | sed 's/-/_/g; s/.*/\L&/')
# elif [ "${{ inputs.platform }}" == "hardkernel" ]; then
# new_name=$(echo "${{ inputs.vendor }}-${{ inputs.model }}_${release}.rom" | sed 's/-/_/g; s/.*/\L&/')
# fi
if [ "${{ inputs.platform }}" == "pcengines" ]; then
new_name="pcengines_${{ inputs.model }}_${release}.rom"
else
new_name="${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
# Create release directory if it doesn't exist
Expand Down

0 comments on commit f1aec3f

Please sign in to comment.