From 86269ec7f184ab640674ed048b5984d53b9b3836 Mon Sep 17 00:00:00 2001 From: s3rj1k Date: Fri, 26 Jan 2024 17:57:42 +0100 Subject: [PATCH] [GHA] Add support for building RPMs using GHA. --- .github/workflows/build.yml | 103 ++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index abc084a..4cd6609 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,6 +15,18 @@ concurrency: group: ${{ github.head_ref || github.ref }} jobs: + build_rpm: + name: 'Build RPM' + uses: signalwire/actions-template/.github/workflows/ci-rpm-packages.yml@main + with: + PROJECT_NAME: libks + RUNNER: ubuntu-latest + PACKAGER: 'packager Andrey Volk ' + PLATFORM: amd64 + USE_CMAKE: true + CMAKE_BUILD_TYPE: 'Debug' + secrets: inherit + build_deb: name: 'Build DEB' uses: signalwire/actions-template/.github/workflows/ci-deb-packages-v2.yml@main @@ -38,6 +50,23 @@ jobs: USE_CMAKE: true CMAKE_BUILD_TYPE: 'Debug' + generate_meta_rpm: + if: (github.ref_type == 'branch' && github.base_ref == '') + name: 'Meta RPM' + needs: [ build_rpm ] + strategy: + matrix: + os: + - rpm + platform: + - amd64 + uses: signalwire/actions-template/.github/workflows/ci-libs-metadata-v2.yml@main + with: + ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.platform }}-artifact + OS_PLATFORM: ${{ matrix.os }}-${{ matrix.platform }} + RUNNER: ubuntu-latest + FILE_PATH_PREFIX: /var/www/libks-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.platform }}/${{ github.run_id }}-${{ github.run_number }} + generate_meta_deb: if: (github.ref_type == 'branch' && github.base_ref == '') name: 'Meta DEB' @@ -61,6 +90,31 @@ jobs: RUNNER: ubuntu-latest FILE_PATH_PREFIX: /var/www/libks-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.platform }}/${{ github.run_id }}-${{ github.run_number }} + distribute_matrix_rpm: + if: (github.ref_type == 'branch' && github.base_ref == '') + permissions: write-all + name: 'Copy to remote RPM' + needs: [ build_rpm ] + strategy: + matrix: + os: + - rpm + platform: + - amd64 + uses: signalwire/actions-template/.github/workflows/cd-scp.yml@main + with: + ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.platform }}-artifact + TARGET_FOLDER: /var/www/libks-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.platform }}/${{ github.run_id }}-${{ github.run_number }} + RUNNER: ubuntu-latest + FILES: '*.tar.gz' + CREATE_DESTINATION_FOLDERS: true + secrets: + # Explicit define secrets for better understanding but it could be just inherit + PROXY_URL: ${{ secrets.PROXY_URL }} + USERNAME: ${{ secrets.USERNAME }} + HOSTNAME: ${{ secrets.HOSTNAME }} + TELEPORT_TOKEN: ${{ secrets.TELEPORT_TOKEN }} + distribute_matrix_deb: if: (github.ref_type == 'branch' && github.base_ref == '') permissions: write-all @@ -92,6 +146,33 @@ jobs: HOSTNAME: ${{ secrets.HOSTNAME }} TELEPORT_TOKEN: ${{ secrets.TELEPORT_TOKEN }} + distribute_meta_rpm: + if: (github.ref_type == 'branch' && github.base_ref == '') + permissions: write-all + name: 'Copy meta to remote RPM' + needs: [ generate_meta_rpm ] + strategy: + max-parallel: 1 + matrix: + os: + - rpm + platform: + - amd64 + uses: signalwire/actions-template/.github/workflows/cd-libs-metadata.yml@main + with: + ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.platform }}-meta + LIB_NAME: sofia-sip + SOURCE_BRANCH: ${{ github.ref_name }} + TARGET_OS: ${{ matrix.os }} + TARGET_PLATFORM: ${{ matrix.platform }} + RUNNER: ubuntu-latest + TARGET_REPO: signalwire/bamboo_gha_trigger + secrets: + GH_BOT_DEPLOY_TOKEN: ${{ secrets.PAT }} + concurrency: + group: libks-${{ matrix.os }}-${{ matrix.platform }} + cancel-in-progress: false + distribute_meta_deb: if: (github.ref_type == 'branch' && github.base_ref == '') permissions: write-all @@ -125,6 +206,28 @@ jobs: group: libks-${{ matrix.os }}-${{ matrix.platform }} cancel-in-progress: true + distribute_hash_rpm: + if: (github.ref_type == 'branch' && github.base_ref == '') + permissions: write-all + name: 'Copy hash to remote RPM' + needs: [ distribute_meta_rpm ] + uses: signalwire/actions-template/.github/workflows/cd-scp.yml@main + strategy: + matrix: + os: + - rpm + platform: + - amd64 + with: + RUNNER: ubuntu-latest + CREATE_DESTINATION_FOLDERS: false + EXEC_COMMANDS: 'echo "${{ github.sha }}" > /var/www/libks-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.platform }}/${{ github.run_id }}-${{ github.run_number }}/hash.txt' + secrets: + PROXY_URL: ${{ secrets.PROXY_URL }} + USERNAME: ${{ secrets.USERNAME }} + HOSTNAME: ${{ secrets.HOSTNAME }} + TELEPORT_TOKEN: ${{ secrets.TELEPORT_TOKEN }} + distribute_hash_deb: if: (github.ref_type == 'branch' && github.base_ref == '') permissions: write-all