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 1, 2024
1 parent b7b3691 commit c4ffc22
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 31 deletions.
18 changes: 17 additions & 1 deletion .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,10 +363,13 @@ 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
Expand All @@ -363,8 +378,9 @@ jobs:
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 ]
55 changes: 25 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,28 @@ 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
fi
# Create release directory if it doesn't exist
Expand Down

0 comments on commit c4ffc22

Please sign in to comment.