From acd1800cbe172121cd573de1ce86d3c3f568dd45 Mon Sep 17 00:00:00 2001 From: Pawel Langowski Date: Tue, 1 Oct 2024 11:06:12 +0200 Subject: [PATCH] wip: simplify workflow Signed-off-by: Pawel Langowski --- .github/workflows/build.yml | 18 ++++++++- .github/workflows/deploy-template.yml | 55 ++++++++++++--------------- 2 files changed, 42 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0b1e1e90c20..2087eec236f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -265,6 +265,8 @@ jobs: platform: protectli vendor: ${{ matrix.vendor }} model: ${{ matrix.model }} + artifact_name: "dasharo-${{ matrix.vendor }}-${{ matrix.model }}" + secrets: inherit strategy: matrix: @@ -278,6 +280,7 @@ jobs: platform: protectli vendor: ${{ matrix.vendor }} model: ${{ matrix.model }} + artifact_name: "dasharo-${{ matrix.vendor }}-${{ matrix.model }}" secrets: inherit strategy: matrix: @@ -291,6 +294,7 @@ jobs: platform: protectli vendor: ${{ matrix.vendor }} model: ${{ matrix.model }} + artifact_name: "dasharo-${{ matrix.vendor }}-${{ matrix.model }}" secrets: inherit strategy: matrix: @@ -304,6 +308,7 @@ jobs: platform: protectli vendor: ${{ matrix.vendor }} model: ${{ matrix.model }} + artifact_name: "dasharo-${{ matrix.vendor }}-${{ matrix.model }}" secrets: inherit strategy: matrix: @@ -317,6 +322,7 @@ jobs: platform: protectli vendor: ${{ matrix.vendor }} model: ${{ matrix.model }} + artifact_name: "dasharo-${{ matrix.vendor }}-${{ matrix.model }}" secrets: inherit strategy: matrix: @@ -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 @@ -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: @@ -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 @@ -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 ] \ No newline at end of file + model: [ odroid_h4 ] diff --git a/.github/workflows/deploy-template.yml b/.github/workflows/deploy-template.yml index ffd96634133..a3bf544643d 100644 --- a/.github/workflows/deploy-template.yml +++ b/.github/workflows/deploy-template.yml @@ -16,6 +16,8 @@ on: type: type: string required: false + artifact_name: + type: string jobs: deploy: @@ -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 @@ -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