Skip to content

Commit

Permalink
Merge pull request #196 from signalwire/gha_rpm
Browse files Browse the repository at this point in the history
[GHA] Add support for building RPMs using GHA.
  • Loading branch information
andywolk authored Jan 29, 2024
2 parents 7b26339 + 86269ec commit 71e2111
Showing 1 changed file with 103 additions and 0 deletions.
103 changes: 103 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <andrey@signalwire.com>'
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
Expand All @@ -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'
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 71e2111

Please sign in to comment.