From c5b8666596fdb730d19eb77b90d35947fae862cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edu=20G=C3=B3mez=20Escandell?= Date: Tue, 6 Feb 2024 11:59:49 +0100 Subject: [PATCH 1/3] Add source package to artefact --- gh-actions/common/build-debian/action.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gh-actions/common/build-debian/action.yml b/gh-actions/common/build-debian/action.yml index a912bfe..3c95052 100644 --- a/gh-actions/common/build-debian/action.yml +++ b/gh-actions/common/build-debian/action.yml @@ -106,7 +106,12 @@ runs: artifacts-dir: ${{ env.BUILD_OUTPUT_DIR }} source-dir: ${{ env.BUILD_INPUT_DIR }} docker-image: ${{ inputs.docker-image }} - - name: Upload artifacts + - name: Copy source package to output dir + shell: bash + run: | + set -eu + cp -r ${{ env.SOURCE_OUTPUT_DIR }}/* ${{ env.BUILD_OUTPUT_DIR }} + - name: Upload artefacts uses: actions/upload-artifact@v4 with: name: ${{ env.PKG_NAME }}_${{ env.PKG_VERSION }} From 918af216357e7b5dd539ea36df1c115f9ff2302b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edu=20G=C3=B3mez=20Escandell?= Date: Tue, 6 Feb 2024 12:06:33 +0100 Subject: [PATCH 2/3] Add lintian check to source package --- gh-actions/common/build-debian/action.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gh-actions/common/build-debian/action.yml b/gh-actions/common/build-debian/action.yml index 3c95052..46aa4aa 100644 --- a/gh-actions/common/build-debian/action.yml +++ b/gh-actions/common/build-debian/action.yml @@ -12,6 +12,10 @@ inputs: token: required: false description: If provided, used for git authentication in the source build + lintian: + required: false + description: Arguments to pass to lintian, if any. Set to false to skip the lintian chek. + default: '' # The process: @@ -79,6 +83,11 @@ runs: if [ -n "${GITHUB_TOKEN}" ]; then git config --system url."https://api:${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/" fi + - name: Run lintian + if: inputs.lintian != 'false' + shell: bash + working-directory: ${{ env.SOURCE_OUTPUT_DIR }} + run: lintian ${{ inputs.lintian }} -- *.changes - name: Set up package build shell: bash run: | From 9eb66d6d5726d711188a284e65c49341b519c967 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edu=20G=C3=B3mez=20Escandell?= Date: Tue, 6 Feb 2024 13:39:09 +0100 Subject: [PATCH 3/3] Make debian version compliant Fix warnings related to: - Version number - File too long - No contributor name - Extra whitespace around name --- gh-actions/common/build-debian/action.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/gh-actions/common/build-debian/action.yml b/gh-actions/common/build-debian/action.yml index 46aa4aa..9f6cc43 100644 --- a/gh-actions/common/build-debian/action.yml +++ b/gh-actions/common/build-debian/action.yml @@ -55,10 +55,20 @@ runs: DEBIAN_FRONTEND=noninteractive sudo apt install -y devscripts echo "::endgroup::" - echo "::group::Append commit SHA to local version" + echo "::group::Create local version with commit and docker container" cd '${{ inputs.source-dir }}' - sanitized_docker=$( echo "${{ inputs.docker-image }}" | sed 's/://' ) - debchange --local "+${sanitized_docker}+${{ github.sha }}" "Github build. Job id: ${{ github.run_id }}. Attempt: ${{ github.run_number }}." + + # Sanitize the docker name so that it stick to debian policy + # https://www.debian.org/doc/debian-policy/ch-controlfields.html#version + sanitized_docker=$( echo "${{ inputs.docker-image }}" | sed -r 's/[^a-zA-Z0-9.+~]+/+/g' ) + + # Short commit to avoid "package-has-long-file-name" + commit=$(echo ${{ github.sha }} | cut -c1-8) + + export DEBFULLNAME="GitHub actions runner" + export DEBEMAIL="noreply@github.com" + debchange --local "~${sanitized_docker}+${commit}" "Github build. Run id: ${{ github.run_id }}. Run number: ${{ github.run_number }}." + echo "::endgroup::" echo "::group::Parsing name and version"