Skip to content

[GHA] Add package Build and Distribute workflow. #10

[GHA] Add package Build and Distribute workflow.

[GHA] Add package Build and Distribute workflow. #10

Workflow file for this run

name: Build and Distribute
on:
pull_request:
push:
branches:
- release
- master
paths:
- "**"
- "!debian/changelog"
workflow_dispatch:
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: signalwire-c
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
strategy:
fail-fast: false
matrix:
codename:
- bookworm
- bullseye
- buster
- stretch
platform:
- amd64
- armhf
with:
PROJECT_NAME: signalwire-c
RUNNER: ubuntu-latest
BASE_IMAGE: signalwire/build-deb-action
DISTRO_CODENAME: ${{ matrix.codename }}
PLATFORM: ${{ matrix.platform }}
USE_CMAKE: true
CMAKE_BUILD_TYPE: 'Debug'
PREBUILD_SCRIPT: |

Check failure on line 52 in .github/workflows/build.yml

View workflow run for this annotation

GitHub Actions / Build and Distribute

Invalid workflow file

The workflow is not valid. .github/workflows/build.yml (Line: 52, Col: 24): Invalid input, PREBUILD_SCRIPT is not defined in the referenced workflow. .github/workflows/build.yml (Line: 79, Col: 22): Invalid secret, GENERIC_TOKEN is not defined in the referenced workflow.
if [ -z "${GENERIC_TOKEN}" ]; then
echo "Error: GENERIC_TOKEN is empty or not set."
exit 1
fi
release_codename=$(lsb_release -sc)
if [ $? -ne 0 ]; then
echo "Error: Failed to get release codename, none zero exit code."
exit 1
fi
if [ -z "${release_codename}" ]; then
echo "Error: Failed to get release codename, empty codename."
exit 1
fi
echo "machine freeswitch.signalwire.com login signalwire password ${GENERIC_TOKEN}" > /root/.netrc
cp -f /root/.netrc /etc/apt/auth.conf
echo "deb [signed-by=/usr/share/keyrings/signalwire-freeswitch-repo.gpg] https://freeswitch.signalwire.com/repo/deb/debian-release/ ${release_codename} main" > /etc/apt/sources.list.d/freeswitch.list
echo "deb-src [signed-by=/usr/share/keyrings/signalwire-freeswitch-repo.gpg] https://freeswitch.signalwire.com/repo/deb/debian-release/ ${release_codename} main" >> /etc/apt/sources.list.d/freeswitch.list
wget -O /usr/share/keyrings/signalwire-freeswitch-repo.gpg \
https://freeswitch.signalwire.com/repo/deb/debian-release/signalwire-freeswitch-repo.gpg && \
apt-get -q update && apt-get -y install libks2
secrets:
GENERIC_TOKEN: ${{ secrets.REPOTOKEN }}
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/signalwire-c-${{ 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'
needs: [ build_deb ]
strategy:
matrix:
os:
- deb
codename:
- bookworm
- bullseye
- buster
- stretch
platform:
- amd64
- armhf
uses: signalwire/actions-template/.github/workflows/ci-libs-metadata-v2.yml@main
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/signalwire-c-${{ 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/signalwire-c-${{ 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
name: 'Copy to remote DEB'
needs: [ build_deb ]
strategy:
matrix:
os:
- deb
codename:
- bookworm
- bullseye
- buster
- stretch
platform:
- amd64
- armhf
uses: signalwire/actions-template/.github/workflows/cd-scp.yml@main
with:
ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.codename }}-${{ matrix.platform }}-artifact
TARGET_FOLDER: /var/www/signalwire-c-${{ 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_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: signalwire-c
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: signalwire-c-${{ matrix.os }}-${{ matrix.platform }}
cancel-in-progress: false
distribute_meta_deb:
if: (github.ref_type == 'branch' && github.base_ref == '')
permissions: write-all
name: 'Copy meta to remote DEB'
needs: [ generate_meta_deb ]
strategy:
max-parallel: 1
matrix:
os:
- deb
codename:
- bookworm
- bullseye
- buster
- stretch
platform:
- amd64
- armhf
uses: signalwire/actions-template/.github/workflows/cd-libs-metadata.yml@main
with:
ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.codename }}-${{ matrix.platform }}-meta
LIB_NAME: signalwire-c
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: signalwire-c-${{ 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/signalwire-c-${{ 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
name: 'Copy hash to remote DEB'
needs: [ distribute_meta_deb ]
uses: signalwire/actions-template/.github/workflows/cd-scp.yml@main
strategy:
matrix:
os:
- deb
platform:
- amd64
- armhf
with:
RUNNER: ubuntu-latest
CREATE_DESTINATION_FOLDERS: false
EXEC_COMMANDS: 'echo "${{ github.sha }}" > /var/www/signalwire-c-${{ 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 }}