Fix file name mismatch in deb workflow: convert hyphens to underscores #134
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Debian Packages | |
| on: | |
| push: | |
| pull_request: | |
| branches: ["main"] | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| jobs: | |
| setup: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| is_release_build: ${{ env.RELEASE_BUILD == '1' }} | |
| steps: | |
| - uses: jfrog/setup-jfrog-cli@v4 | |
| env: | |
| JF_URL: ${{ secrets.SDK_URL }} | |
| JF_ACCESS_TOKEN: ${{ secrets.SDK_TOKEN }} | |
| with: | |
| disable-auto-build-publish: true | |
| disable-job-summary: true | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check for release build and tag | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| TAG_NAME="${GITHUB_REF#refs/tags/}" | |
| echo "Build release for $TAG_NAME" | |
| echo "RELEASE_BUILD=1" >> $GITHUB_ENV | |
| echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV | |
| # login | |
| - name: Authenticate to Artifactory | |
| run: | | |
| jf c add --url=$JF_URL --access-token=$JF_ACCESS_TOKEN --interactive=false | |
| # download control files | |
| - name: Download control files from Artifactory | |
| id: get_matrix | |
| run: | | |
| set +x | |
| set -e | |
| build_config=$(cat .github/workflows/build_config.json) | |
| # Get the latest pylon version from Artifactory | |
| pylon_default_version=$(jf rt s "pylon-artifacts-generic-prod/setup/*" | jq '.[] | .path' | awk -F'/' '{print $3}' | sort -V | uniq | tac | head -n 1) | |
| for os in $(echo $build_config | jq -r 'keys[]'); do | |
| for pylon_sdk in $(echo $build_config | jq -r --arg os "$os" '.[$os].pylon_sdk_packaging'); do | |
| # When TAG_NAME is set (release build), use the pylon version from the tag, stripping any rc suffix | |
| tag=$(echo "${TAG_NAME:-$pylon_default_version}" | sed 's/rc[0-9]*$//') | |
| if [[ $os == "linux-x86_64" ]]; then | |
| os_search="linux_x86_64" | |
| elif [[ $os == "linux-aarch64" ]]; then | |
| os_search="linux_aarch64" | |
| fi | |
| echo "Downloading control files for $os_search using pylon $tag" | |
| # Find the latest build number for the given pylon version | |
| latest_build=$(jf rt s "pylon-artifacts-generic-*/setup/*/report_${os_search}*.json" | jq -r --arg tag "$tag" '.[] | select(.path | test($tag)) | .path' | sed -E 's|.*/([0-9]{8}\.[0-9]+)/.*|\1|' | sort -V | tail -1) | |
| # Download control files | |
| for path in $(jf rt s "pylon-artifacts-generic-*/setup/*/report_${os_search}*.json" | jq -r --arg tag "$tag" --arg build "$latest_build" '.[] | select(.path | test($tag)) | select(.path | test($build)) | .path'); do | |
| jf rt dl --flat $path ./${os_search}/report_${os_search}.json | |
| done | |
| # Download 3rd party licenses | |
| for path in $(jf rt s "pylon-artifacts-generic-*/setup/*/oso_${os_search}*.txt" | jq -r --arg tag "$tag" --arg build "$latest_build" '.[] | select(.path | test($tag)) | select(.path | test($build)) | .path'); do | |
| jf rt dl --flat $path ./${os_search}/pylon_Third-Party_Licenses.txt | |
| done | |
| done | |
| done | |
| - name: Upload control files for Linux aarch64 | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Linux_aarch64_packaging_Pylon | |
| path: linux_aarch64 | |
| - name: Upload control files for Linux x86_64 | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Linux_x86_64_packaging_Pylon | |
| path: linux_x86_64 | |
| download_packaging: | |
| needs: setup | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - linux-x86_64 | |
| - linux-aarch64 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Install conan v1 | |
| run: pip install "conan<2" | |
| - name: Add conan v1 remote and authenticate | |
| env: | |
| JF_URL: ${{ secrets.SDK_URL }} | |
| JF_USER: ${{ secrets.SDK_USER }} | |
| JF_ACCESS_TOKEN: ${{ secrets.SDK_TOKEN }} | |
| run: | | |
| import os | |
| import subprocess | |
| subprocess.run(["conan", "config", "set", "general.revisions_enabled=1"], check=True) | |
| subprocess.run([ | |
| "conan", "remote", "add", "pylon-conan-prod", | |
| f"{os.environ['JF_URL']}/artifactory/api/conan/pylon-conan-prod", "--insert", "0" | |
| ], check=True) | |
| subprocess.run([ | |
| "conan", "user", "-p", os.environ["JF_ACCESS_TOKEN"], | |
| "-r", "pylon-conan-prod", os.environ["JF_USER"] | |
| ], check=True) | |
| shell: python | |
| - name: Download ${{ matrix.os }} control artifacts | |
| uses: actions/download-artifact@v5 | |
| with: | |
| pattern: ${{ matrix.os == 'linux-x86_64' && 'Linux_x86_64' || 'Linux_aarch64' }}*packaging*Pylon | |
| merge-multiple: true | |
| path: pylon-install-files | |
| - name: Download needed pylon modules | |
| run: | | |
| import os | |
| import subprocess | |
| arch = "x64" if "${{ matrix.os }}" == "linux-x86_64" else "arm64" | |
| profile = f"linux_{arch}" | |
| # Convert os name from hyphens to underscores to match file naming convention | |
| os_key = "${{ matrix.os }}".replace("-", "_") | |
| subprocess.run([ | |
| "conan", "install", "--update", "--install-folder", "conan", | |
| "-pr", os.path.join(os.environ['GITHUB_WORKSPACE'], ".github", "workflows", "profiles", profile), | |
| "-o", f"gst-plugin-pylon:control_file={os.path.join(os.environ['GITHUB_WORKSPACE'], 'pylon-install-files', f'report_{os_key}.json')}", | |
| "-o", f"gst-plugin-pylon:third_party_license_file={os.path.join(os.environ['GITHUB_WORKSPACE'], 'pylon-install-files', 'pylon_Third-Party_Licenses.txt')}", | |
| "-c", "tools.system.package_manager:mode=install", | |
| "-c", "tools.system.package_manager:sudo=True", | |
| os.path.join(os.environ['GITHUB_WORKSPACE'], ".github", "workflows", "conanfile.py") | |
| ], check=True) | |
| shell: python | |
| - name: Tar pylon SDK files | |
| run: cd conan && tar -czf ../pylon_sdk.tar.gz . | |
| - name: Upload pylon SDK for ${{ matrix.os }} packaging | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.os == 'linux-x86_64' && 'Linux_x86_64' || 'Linux_aarch64' }}_packaging_Pylon_SDK | |
| path: pylon_sdk.tar.gz | |
| build_deb: | |
| runs-on: ubuntu-latest | |
| needs: [setup, download_packaging] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - ubuntu:24.04 | |
| - ubuntu:22.04 | |
| - ubuntu:20.04 | |
| - debian:bookworm | |
| - debian:bullseye | |
| arch: ["arm64", "amd64"] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download x86_64 SDK | |
| if: matrix.arch == 'amd64' | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: Linux_x86_64_packaging_Pylon_SDK | |
| path: pylon-sdk | |
| - name: Download aarch64 SDK | |
| if: matrix.arch == 'arm64' | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: Linux_aarch64_packaging_Pylon_SDK | |
| path: pylon-sdk | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3.2.0 | |
| with: | |
| platforms: linux/amd64, linux/arm64 | |
| - name: Set sanitized OS name | |
| id: sanitize_os | |
| run: | | |
| SANITIZED_OS=$(echo ${{ matrix.os }} | sed 's/:/./g') | |
| echo "SANITIZED_OS=$SANITIZED_OS" >> $GITHUB_ENV | |
| - name: Build Debian Package | |
| uses: jtdor/build-deb-action@v1 | |
| env: | |
| DEB_BUILD_OPTIONS: noautodbgsym | |
| with: | |
| setup-hook: | | |
| ln -sfn packaging/debian | |
| apt-get update | |
| mkdir -p /opt/pylon | |
| tar -xzf /pylon-sdk/pylon_sdk.tar.gz -C /opt/pylon | |
| # patch version to contain platform info | |
| tools/patch_deb_changelog.sh | |
| docker-image: ${{ matrix.arch == 'arm64' && format('arm64v8/{0}', matrix.os) || format('{0}', matrix.os) }} | |
| extra-docker-args: -v ${{ github.workspace }}/pylon-sdk:/pylon-sdk -e PYLON_ROOT=/opt/pylon --platform linux/${{ matrix.arch }} | |
| buildpackage-opts: --build=binary --no-sign | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: debian-packages-${{ env.SANITIZED_OS }}-${{ matrix.arch }} | |
| path: debian/artifacts/ | |
| - name: Upload Release Asset | |
| if: needs.setup.outputs.is_release_build == 'true' | |
| uses: softprops/action-gh-release@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| files: ./debian/artifacts/*.deb | |
| cleanup: | |
| if: always() | |
| needs: [ | |
| setup, | |
| download_packaging, | |
| build_deb | |
| ] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: geekyeggo/delete-artifact@v5 | |
| continue-on-error: true | |
| with: | |
| name: | | |
| Linux_x86_64_packaging_Pylon | |
| Linux_x86_64_packaging_Pylon_SDK | |
| Linux_aarch64_packaging_Pylon | |
| Linux_aarch64_packaging_Pylon_SDK | |