diff --git a/.github/actions/merge-artifacts/action.yml b/.github/actions/merge-artifacts/action.yml new file mode 100644 index 0000000000..a213c8fa3e --- /dev/null +++ b/.github/actions/merge-artifacts/action.yml @@ -0,0 +1,65 @@ +name: 'Merge Artifacts' +description: 'Merge Artifacts' +inputs: + target_name: + description: 'The name of the result artifact' + required: true + source_paths: + description: 'The path to the files that will be uplaoded' + required: true + source_name_pattern: + description: "Artifact's pattern to be merged" + required: true + github_token: + description: 'The Github Token to use' + required: true + +runs: + using: 'composite' + steps: + - name: Download Artifacts + uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0 + with: + pattern: ${{ inputs.source_name_pattern }}* + path: ${{ inputs.target_name }} + merge-multiple: true + + - name: Upload the Regrouped Artifact + uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0 + with: + name: ${{ inputs.target_name }} + path: | + ${{ inputs.source_paths }} + retention-days: 1 + + - name: Delete Artifacts + run: | + artifact_pattern="${{ inputs.source_name_pattern }}" + TOKEN="${{ inputs.github_token }}" + artifact_exists=true + while [ "$artifact_exists" = true ]; do + artifact_exists=false + artifacts_response=$(curl -L \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $TOKEN" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + "https://api.github.com/repos/${{ github.repository }}/actions/artifacts?per_page=100") + artifacts=$(echo $artifacts_response | jq -c '.artifacts[]') + echo "Those are the artifacts : $artifacts" + while read row; do + artifact_name=$(echo "$row" | jq -r '.name') + if [[ "$artifact_name" =~ ^.*"$artifact_pattern".* ]]; then + artifact_exists=true + echo "Deleting : $artifact_name" + artifact_id=$(echo "$row" | jq -r '.id') + curl -L \ + -X DELETE \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $TOKEN" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + "https://api.github.com/repos/${{ github.repository }}/actions/artifacts/${artifact_id}" + fi + done <<< "$artifacts" + done + echo "End of Deleting" + shell: bash diff --git a/.github/actions/package-nfpm/action.yml b/.github/actions/package-nfpm/action.yml index 32e805df81..85f508669b 100644 --- a/.github/actions/package-nfpm/action.yml +++ b/.github/actions/package-nfpm/action.yml @@ -137,7 +137,7 @@ runs: # Update if condition to true to get packages as artifacts - if: ${{ false }} name: Upload package artifacts - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 + uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 with: name: packages-${{ inputs.distrib }} path: ./*.${{ inputs.package_extension}} diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index e174ac2f92..9d988460ba 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -200,9 +200,18 @@ jobs: cp -r ~/rpmbuild/RPMS/noarch/*.rpm . shell: bash - - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 + - name: Replace '::' with - in the feature path + id: package-name + run: | + name="${{ matrix.name }}" + name_with_dash="${name//::/-}" + echo "Modified Name: $name_with_dash" + echo "name_with_dash=$name_with_dash" >> $GITHUB_OUTPUT + shell: bash + + - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 with: - name: packages-${{ matrix.package_extension }}-${{ matrix.distrib }} + name: packages-${{ matrix.package_extension }}-${{ matrix.distrib }}-${{ steps.package-name.outputs.name_with_dash }} path: ./*.${{ matrix.package_extension }} retention-days: 1 @@ -354,14 +363,59 @@ jobs: DEB_BUILD_OPTIONS="nocheck nodocs notest" dh-make-perl make --dist ${{ matrix.distrib }} --build --version ${{ steps.package-version.outputs.package_version }}-${{ matrix.distrib }} --cpan ${{ matrix.name }} shell: bash - - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 + - name: Replace '::' with - in the feature path + id: package-name + run: | + name="${{ matrix.name }}" + name_with_dash="${name//::/-}" + echo "Modified Name: $name_with_dash" + echo "name_with_dash=$name_with_dash" >> $GITHUB_OUTPUT + shell: bash + + - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 with: - name: packages-${{ matrix.package_extension }}-${{ matrix.distrib }} + name: packages-${{ matrix.package_extension }}-${{ matrix.distrib }}-${{ steps.package-name.outputs.name_with_dash}} path: ./*.${{ matrix.package_extension }} retention-days: 1 - sign-rpm: + merge-package-rpm-artifacts: needs: [package-rpm] + runs-on: ubuntu-22.04 + strategy: + matrix: + distrib: [el8, el9] + + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Merging Artifacts + uses: ./.github/actions/merge-artifacts + with: + target_name: packages-rpm-${{ matrix.distrib }} + source_paths: packages-rpm-${{ matrix.distrib }}/*.rpm + source_name_pattern: packages-rpm-${{ matrix.distrib }}- + github_token: ${{ secrets.GITHUB_TOKEN }} + + merge-package-deb-artifacts: + needs: [package-deb] + runs-on: ubuntu-22.04 + strategy: + matrix: + distrib: [bullseye, bookworm, jammy] + + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Merging Artifacts + uses: ./.github/actions/merge-artifacts + with: + target_name: packages-deb-${{ matrix.distrib }} + source_paths: packages-deb-${{ matrix.distrib }}/*.deb + source_name_pattern: packages-deb-${{ matrix.distrib }}- + github_token: ${{ secrets.GITHUB_TOKEN }} + + sign-rpm: + needs: [merge-package-rpm-artifacts] runs-on: ubuntu-22.04 strategy: @@ -381,7 +435,7 @@ jobs: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 + - uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 with: name: packages-rpm-${{ matrix.distrib }} path: ./ @@ -398,13 +452,13 @@ jobs: key: ${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }} download-and-cache-deb: - needs: [package-deb] + needs: [merge-package-deb-artifacts] runs-on: ubuntu-22.04 strategy: matrix: distrib: [bullseye, bookworm, jammy] steps: - - uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 + - uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 with: name: packages-deb-${{ matrix.distrib }} path: ./ diff --git a/.github/workflows/perl-crypt-argon2.yml b/.github/workflows/perl-crypt-argon2.yml index 9f183d7f9f..ae7c02b5ea 100644 --- a/.github/workflows/perl-crypt-argon2.yml +++ b/.github/workflows/perl-crypt-argon2.yml @@ -130,7 +130,7 @@ jobs: # set condition to true if artifacts are needed - if: ${{ false }} name: Upload package artifacts - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 + uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 with: name: packages-${{ matrix.distrib }}-${{ matrix.arch }} path: ./*.${{ matrix.package_extension}} diff --git a/.github/workflows/perl-json-path.yml b/.github/workflows/perl-json-path.yml index d57120950b..0bb26794d3 100644 --- a/.github/workflows/perl-json-path.yml +++ b/.github/workflows/perl-json-path.yml @@ -116,7 +116,7 @@ jobs: # set condition to true if artifacts are needed - if: ${{ false }} name: Upload package artifacts - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 + uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 with: name: packages-${{ matrix.distrib }} path: ./*.${{ matrix.package_extension}} diff --git a/.github/workflows/perl-keepass-reader.yml b/.github/workflows/perl-keepass-reader.yml index 96296b7fb8..8e2bcc56ed 100644 --- a/.github/workflows/perl-keepass-reader.yml +++ b/.github/workflows/perl-keepass-reader.yml @@ -104,7 +104,7 @@ jobs: path: ./*.rpm key: ${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }} - - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 + - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 with: name: packages-${{ matrix.distrib }} path: ./*.rpm @@ -149,7 +149,7 @@ jobs: path: ./*.deb key: ${{ github.sha }}-${{ github.run_id }}-deb-${{ matrix.distrib }} - - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 + - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 with: name: packages-${{ matrix.distrib }} path: ./*.deb diff --git a/.github/workflows/perl-libssh-session.yml b/.github/workflows/perl-libssh-session.yml index a9e515f165..63cc505ef8 100644 --- a/.github/workflows/perl-libssh-session.yml +++ b/.github/workflows/perl-libssh-session.yml @@ -128,7 +128,7 @@ jobs: # set condition to true if artifacts are needed - if: ${{ false }} name: Upload package artifacts - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 + uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 with: name: packages-${{ matrix.distrib }}-${{ matrix.arch }} path: ./*.${{ matrix.package_extension}} diff --git a/.github/workflows/perl-net-curl.yml b/.github/workflows/perl-net-curl.yml index 0323c26508..3bf2fc9d79 100644 --- a/.github/workflows/perl-net-curl.yml +++ b/.github/workflows/perl-net-curl.yml @@ -128,7 +128,7 @@ jobs: # set condition to true if artifacts are needed - if: ${{ false }} name: Upload package artifacts - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 + uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 with: name: packages-${{ matrix.distrib }}-${{ matrix.arch }} path: ./*.${{ matrix.package_extension }} diff --git a/.github/workflows/perl-openwsman.yml b/.github/workflows/perl-openwsman.yml index c664655c47..c646015355 100644 --- a/.github/workflows/perl-openwsman.yml +++ b/.github/workflows/perl-openwsman.yml @@ -199,7 +199,7 @@ jobs: # set condition to true if artifacts are needed - if: ${{ false }} name: Upload package artifacts - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 + uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 with: name: packages-${{ matrix.distrib }}-${{ matrix.arch }} path: ./*.${{ matrix.package_extension}} diff --git a/.github/workflows/plink.yml b/.github/workflows/plink.yml index 92dc50fc85..e5b55e53e4 100644 --- a/.github/workflows/plink.yml +++ b/.github/workflows/plink.yml @@ -102,7 +102,7 @@ jobs: path: ./*.rpm key: ${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }} - - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 + - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 with: name: packages-${{ matrix.distrib }} path: ./*.rpm