From 2ac5f3bf0e64869382759130aac1ea7575e202dd Mon Sep 17 00:00:00 2001 From: s3rj1k Date: Wed, 10 Jan 2024 17:58:27 +0100 Subject: [PATCH] WiP Signed-off-by: s3rj1k --- .github/workflows/all.yml | 207 +++++++++++++++++++++++++------------- 1 file changed, 139 insertions(+), 68 deletions(-) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index 30a9ba50..c19dad33 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -9,13 +9,12 @@ on: workflow_dispatch: concurrency: - group: ${{ github.head_ref || github.ref }} + group: ${{ github.head_ref || github.ref }} jobs: - sofia_build_rpm: - name: 'Build Rpm' - uses: signalwire/actions-template/.github/workflows/ci-rpm-packages.yml@main + name: 'Build RPM' + uses: s3rj1k/actions-template/.github/workflows/ci-rpm-packages.yml@ci-deb-packages with: PROJECT_NAME: sofia-sip RUNNER: ubuntu-latest @@ -24,130 +23,202 @@ jobs: secrets: inherit sofia_build_deb: - name: 'Build Deb' - uses: signalwire/actions-template/.github/workflows/ci-deb-packages-v2.yml@main + name: 'Build DEB' + uses: s3rj1k/actions-template/.github/workflows/ci-deb-packages-v2.yml@ci-deb-packages strategy: fail-fast: false matrix: - BASE_IMAGE: - - signalwire/build-deb-action:bookworm - - signalwire/build-deb-action:bullseye - - signalwire/build-deb-action:buster - - signalwire/build-deb-action:stretch - PLATFORM: + codename: + - bookworm + - bullseye + - buster + - stretch + platform: - amd64 - arm with: PROJECT_NAME: sofia-sip RUNNER: ubuntu-latest - BASE_IMAGE: ${{matrix.BASE_IMAGE}} - PLATFORM: ${{matrix.PLATFORM}} + BASE_IMAGE: signalwire/build-deb-action + DISTRO_CODENAME: ${{ matrix.codename }} + PLATFORM: ${{ matrix.platform }} - generate_meta: - name: 'Meta' - needs: [sofia_build_rpm, sofia_build_deb] + generate_meta_rpm: + name: 'Meta RPM' + needs: [ sofia_build_rpm ] strategy: matrix: + os: + - rpm platform: - - deb-amd64 - - deb-arm - - rpm-amd64 - - uses: signalwire/actions-template/.github/workflows/ci-libs-metadata-v2.yml@main + - amd64 + uses: s3rj1k/actions-template/.github/workflows/ci-libs-metadata-v2.yml@ci-deb-packages with: - ARTIFACT_NAME: ${{ matrix.platform }}-artifact - OS_PLATFORM: ${{ matrix.platform }} + ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.platform }}-artifact + OS_PLATFORM: ${{ matrix.os }}-${{ matrix.platform }} RUNNER: ubuntu-latest - FILE_PATH_PREFIX: /var/www/sofia-${{ matrix.platform }}/${{github.run_id}}-${{github.run_number}} + FILE_PATH_PREFIX: /var/www/sofia-${{ matrix.os }}-${{ matrix.platform }}/${{ github.run_id }}-${{ github.run_number }} - distribute_matrix: + generate_meta_deb: + name: 'Meta DEB' + needs: [ sofia_build_deb ] + strategy: + matrix: + os: + - deb + codename: + - bookworm + - bullseye + - buster + - stretch + platform: + - amd64 + - arm + uses: s3rj1k/actions-template/.github/workflows/ci-libs-metadata-v2.yml@ci-deb-packages + with: + ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.codename }}-${{ matrix.platform }}-artifact + OS_PLATFORM: ${{ matrix.os }}-${{ matrix.codename }}-${{ matrix.platform }} + RUNNER: ubuntu-latest + FILE_PATH_PREFIX: /var/www/sofia-${{ matrix.os }}-${{ matrix.platform }}/${{ github.run_id }}-${{ github.run_number }} + + distribute_matrix_rpm: permissions: write-all - name: 'Copy to remote' - needs: [sofia_build_rpm, sofia_build_deb] + name: 'Copy to remote RPM' + needs: [ sofia_build_rpm ] strategy: matrix: - os_platform: - - deb-amd64 - - deb-arm - - rpm-amd64 - - uses: signalwire/actions-template/.github/workflows/cd-scp.yml@main + os: + - rpm + platform: + - amd64 + uses: s3rj1k/actions-template/.github/workflows/cd-scp.yml@ci-deb-packages with: - ARTIFACT_NAME: ${{ matrix.os_platform }}-artifact - TARGET_FOLDER: /var/www/sofia-${{ matrix.os_platform }}/${{github.run_id}}-${{github.run_number}} + ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.platform }}-artifact + TARGET_FOLDER: /var/www/sofia-${{ 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 + 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_meta_deb: + + distribute_matrix_deb: permissions: write-all - name: 'Copy meta to remote' - needs: generate_meta + name: 'Copy to remote DEB' + needs: [ sofia_build_deb ] strategy: matrix: os: - deb + codename: + - bookworm + - bullseye + - buster + - stretch platform: - amd64 - arm - - uses: signalwire/actions-template/.github/workflows/cd-libs-metadata.yml@main + uses: s3rj1k/actions-template/.github/workflows/cd-scp.yml@ci-deb-packages + with: + ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.codename }}-${{ matrix.platform }}-artifact + TARGET_FOLDER: /var/www/sofia-${{ 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_meta_rpm: + permissions: write-all + name: 'Copy meta to remote RPM' + needs: [ generate_meta_rpm ] + strategy: + matrix: + os: + - rpm + platform: + - amd64 + uses: s3rj1k/actions-template/.github/workflows/cd-libs-metadata.yml@ci-deb-packages with: - ARTIFACT_NAME: ${{ matrix.os }}-${{matrix.platform}}-meta + ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.platform }}-meta LIB_NAME: sofia-sip TARGET_OS: ${{ matrix.os }} TARGET_PLATFORM: ${{ matrix.platform }} RUNNER: ubuntu-latest TARGET_REPO: signalwire/bamboo_gha_trigger - secrets: - GH_BOT_DEPLOY_TOKEN: ${{ secrets.PAT }} - - distribute_meta_rpm: + secrets: + GH_BOT_DEPLOY_TOKEN: ${{ secrets.PAT }}-disable + + distribute_meta_deb: permissions: write-all - name: 'Copy meta to remote' - needs: generate_meta + name: 'Copy meta to remote DEB' + needs: [ generate_meta_deb ] strategy: matrix: os: - - rpm + - deb platform: - amd64 - - uses: signalwire/actions-template/.github/workflows/cd-libs-metadata.yml@main + - arm + uses: s3rj1k/actions-template/.github/workflows/cd-libs-metadata.yml@ci-deb-packages with: - ARTIFACT_NAME: ${{ matrix.os }}-${{matrix.platform}}-meta + ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.codename }}-${{ matrix.platform }}-meta LIB_NAME: sofia-sip TARGET_OS: ${{ matrix.os }} TARGET_PLATFORM: ${{ matrix.platform }} RUNNER: ubuntu-latest TARGET_REPO: signalwire/bamboo_gha_trigger secrets: - GH_BOT_DEPLOY_TOKEN: ${{ secrets.PAT }} - - distribute_hash: + GH_BOT_DEPLOY_TOKEN: ${{ secrets.PAT }}-disable + + distribute_hash_rpm: + if: github.ref == 'refs/heads/main' + permissions: write-all + name: 'Copy hash to remote RPM' + needs: [ distribute_meta_rpm ] + uses: s3rj1k/actions-template/.github/workflows/cd-scp.yml@ci-deb-packages + strategy: + matrix: + os: + - rpm + platform: + - amd64 + with: + RUNNER: ubuntu-latest + CREATE_DESTINATION_FOLDERS: false + EXEC_COMMANDS: 'echo "${{ github.sha }}" > /var/www/sofia-${{ 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 == 'refs/heads/main' permissions: write-all - name: 'Copy hash to remote' - needs: [distribute_meta_deb, distribute_meta_rpm] - uses: signalwire/actions-template/.github/workflows/cd-scp.yml@main + name: 'Copy hash to remote DEB' + needs: [ distribute_meta_deb ] + uses: s3rj1k/actions-template/.github/workflows/cd-scp.yml@ci-deb-packages strategy: matrix: - os_platform: - - deb-amd64 - - deb-arm - - rpm-amd64 + os: + - deb + platform: + - amd64 + - arm with: RUNNER: ubuntu-latest CREATE_DESTINATION_FOLDERS: false - EXEC_COMMANDS: 'echo "${{github.sha}}" > /var/www/sofia-${{ matrix.os_platform }}/${{github.run_id}}-${{github.run_number}}/hash.txt' - secrets: + EXEC_COMMANDS: 'echo "${{ github.sha }}" > /var/www/sofia-${{ 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 }} - \ No newline at end of file