diff --git a/gh-actions/common/build-debian/action.yml b/gh-actions/common/build-debian/action.yml index a912bfe..9f6cc43 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: @@ -51,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" @@ -79,6 +93,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: | @@ -106,7 +125,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 }}