2024-06-06 21:59:10 +00:00
|
|
|
name: Build and Distribute
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
2024-07-22 14:39:05 +00:00
|
|
|
- v1.10
|
2024-06-06 21:59:10 +00:00
|
|
|
paths:
|
|
|
|
- "**"
|
|
|
|
workflow_dispatch:
|
2024-12-11 00:18:37 +00:00
|
|
|
inputs:
|
|
|
|
freeswitch_ref:
|
|
|
|
description: 'FreeSWITCH repository ref'
|
|
|
|
required: true
|
|
|
|
default: master
|
|
|
|
type: string
|
|
|
|
release:
|
|
|
|
description: 'FreeSWITCH release type'
|
|
|
|
type: choice
|
|
|
|
required: true
|
|
|
|
default: unstable
|
|
|
|
options:
|
|
|
|
- release
|
|
|
|
- unstable
|
|
|
|
publish:
|
|
|
|
description: 'Publish build data'
|
|
|
|
required: true
|
|
|
|
default: false
|
|
|
|
type: boolean
|
2024-06-06 21:59:10 +00:00
|
|
|
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.head_ref || github.ref }}
|
|
|
|
|
|
|
|
jobs:
|
2024-09-21 11:19:22 +00:00
|
|
|
preconfig:
|
2024-12-11 00:18:37 +00:00
|
|
|
name: 'Preconfig'
|
2024-06-06 21:59:10 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
deb: ${{ steps.deb.outputs.excludes }}
|
2024-09-21 11:19:22 +00:00
|
|
|
release: ${{ steps.release.outputs.release }}
|
2024-06-06 21:59:10 +00:00
|
|
|
steps:
|
2024-09-21 11:19:22 +00:00
|
|
|
- name: Generate Matrix excludes for DEB
|
|
|
|
id: deb
|
2024-06-06 21:59:10 +00:00
|
|
|
run: |
|
|
|
|
JSON="[]"
|
|
|
|
|
2024-06-25 18:35:43 +00:00
|
|
|
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
2024-06-06 21:59:10 +00:00
|
|
|
JSON=$(jq -n '[
|
|
|
|
{
|
|
|
|
"version": "bookworm",
|
|
|
|
"platform": {
|
2024-08-02 16:54:28 +00:00
|
|
|
"name": "arm64v8"
|
2024-06-06 21:59:10 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2024-08-02 16:54:28 +00:00
|
|
|
"version": "bullseye",
|
2024-06-06 21:59:10 +00:00
|
|
|
"platform": {
|
2024-08-02 16:54:28 +00:00
|
|
|
"name": "amd64"
|
2024-06-06 21:59:10 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2024-08-02 16:54:28 +00:00
|
|
|
"version": "bullseye",
|
|
|
|
"platform": {
|
|
|
|
"name": "arm32v7"
|
|
|
|
}
|
2024-06-06 21:59:10 +00:00
|
|
|
}
|
|
|
|
]')
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "excludes=$(echo $JSON | jq -c .)" | tee -a $GITHUB_OUTPUT
|
|
|
|
|
2024-09-21 11:19:22 +00:00
|
|
|
- name: Get release type based on branch
|
|
|
|
id: release
|
|
|
|
run: |
|
|
|
|
if [[ '${{ github.event_name }}' == 'pull_request' ]]; then
|
2024-12-12 14:12:38 +00:00
|
|
|
if [[ '${{ github.base_ref }}' == 'v1.10' ]]; then
|
2024-09-21 11:19:22 +00:00
|
|
|
echo 'release=release' | tee -a $GITHUB_OUTPUT
|
2024-12-12 14:12:38 +00:00
|
|
|
else
|
|
|
|
echo 'release=unstable' | tee -a $GITHUB_OUTPUT
|
2024-09-21 11:19:22 +00:00
|
|
|
fi
|
2024-12-11 00:18:37 +00:00
|
|
|
elif [[ '${{ github.event_name }}' == 'workflow_dispatch' ]]; then
|
|
|
|
echo 'release=${{ inputs.release }}' | tee -a $GITHUB_OUTPUT
|
2024-09-21 11:19:22 +00:00
|
|
|
elif [[ '${{ github.ref }}' == 'refs/heads/v1.10' ]]; then
|
|
|
|
echo 'release=release' | tee -a $GITHUB_OUTPUT
|
|
|
|
else
|
2024-12-12 14:12:38 +00:00
|
|
|
echo 'release=unstable' | tee -a $GITHUB_OUTPUT
|
2024-09-21 11:19:22 +00:00
|
|
|
fi
|
|
|
|
|
2024-12-11 00:18:37 +00:00
|
|
|
get-nonce:
|
|
|
|
name: 'Get Nonce for token'
|
|
|
|
runs-on: freeswitch-repo-auth-client
|
|
|
|
outputs:
|
|
|
|
nonce: ${{ steps.get-nonce.outputs.nonce }}
|
|
|
|
steps:
|
|
|
|
- name: Get Nonce
|
|
|
|
id: get-nonce
|
|
|
|
uses: signalwire/actions-template/.github/actions/repo-auth-client@main
|
|
|
|
with:
|
|
|
|
mode: nonce
|
|
|
|
|
|
|
|
issue-token:
|
|
|
|
name: 'Issue temporary token'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: get-nonce
|
|
|
|
outputs:
|
|
|
|
token: ${{ steps.issue-token.outputs.token }}
|
|
|
|
steps:
|
|
|
|
- name: Issue Token
|
|
|
|
id: issue-token
|
|
|
|
uses: signalwire/actions-template/.github/actions/repo-auth-client@main
|
|
|
|
env:
|
|
|
|
NONCE: ${{ needs.get-nonce.outputs.nonce }}
|
|
|
|
with:
|
|
|
|
mode: issue
|
|
|
|
|
2024-09-21 11:19:22 +00:00
|
|
|
deb-public:
|
|
|
|
name: 'DEB-PUBLIC'
|
2024-06-06 21:59:10 +00:00
|
|
|
permissions:
|
|
|
|
id-token: write
|
|
|
|
contents: read
|
|
|
|
needs:
|
2024-09-21 11:19:22 +00:00
|
|
|
- preconfig
|
2024-12-11 00:18:37 +00:00
|
|
|
- issue-token
|
2024-06-06 21:59:10 +00:00
|
|
|
uses: signalwire/actions-template/.github/workflows/cicd-docker-build-and-distribute.yml@main
|
|
|
|
strategy:
|
|
|
|
# max-parallel: 1
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
os:
|
|
|
|
- debian
|
|
|
|
version:
|
|
|
|
- bookworm
|
|
|
|
- bullseye
|
|
|
|
platform:
|
|
|
|
- name: amd64
|
|
|
|
runner: ubuntu-latest
|
|
|
|
- name: arm32v7
|
|
|
|
runner: linux-arm64-4-core-public
|
|
|
|
- name: arm64v8
|
|
|
|
runner: linux-arm64-4-core-public
|
2024-09-21 11:19:22 +00:00
|
|
|
release:
|
|
|
|
- ${{ needs.preconfig.outputs.release }}
|
|
|
|
exclude: ${{ fromJson(needs.preconfig.outputs.deb) }}
|
2024-06-06 21:59:10 +00:00
|
|
|
with:
|
|
|
|
RUNNER: ${{ matrix.platform.runner }}
|
2024-12-11 00:18:37 +00:00
|
|
|
REF: ${{ inputs.freeswitch_ref }}
|
2024-06-06 21:59:10 +00:00
|
|
|
ARTIFACTS_PATTERN: '.*\.(deb|dsc|changes|tar.bz2|tar.gz|tar.lzma|tar.xz)$'
|
2024-09-21 11:19:22 +00:00
|
|
|
DOCKERFILE: .github/docker/${{ matrix.os }}/${{ matrix.version }}/${{ matrix.platform.name }}/public.${{ matrix.release }}.Dockerfile
|
2024-06-06 21:59:10 +00:00
|
|
|
MAINTAINER: 'Andrey Volk <andrey@signalwire.com>'
|
2024-09-21 11:19:22 +00:00
|
|
|
META_FILE_PATH_PREFIX: /var/www/freeswitch/public/${{ matrix.release }}/${{ github.ref_name }}/${{ github.run_id }}-${{ github.run_number }}
|
2024-06-06 21:59:10 +00:00
|
|
|
PLATFORM: ${{ matrix.platform.name }}
|
2024-09-21 11:19:22 +00:00
|
|
|
REPO_DOMAIN: 'freeswitch.signalwire.com'
|
|
|
|
TARGET_ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.version }}-${{ matrix.platform.name }}-public-${{ matrix.release }}-artifact
|
2024-12-11 00:18:37 +00:00
|
|
|
UPLOAD_BUILD_ARTIFACTS: >-
|
|
|
|
${{
|
|
|
|
(github.event.pull_request.head.repo.full_name == github.repository) &&
|
|
|
|
(
|
|
|
|
(
|
|
|
|
github.event_name != 'pull_request' &&
|
|
|
|
github.event_name != 'workflow_dispatch'
|
|
|
|
) ||
|
|
|
|
(github.event_name == 'workflow_dispatch' && inputs.publish)
|
|
|
|
)
|
|
|
|
}}
|
2024-06-06 21:59:10 +00:00
|
|
|
secrets:
|
|
|
|
GH_BOT_DEPLOY_TOKEN: ${{ secrets.PAT }}
|
|
|
|
HOSTNAME: ${{ secrets.HOSTNAME }}
|
|
|
|
PROXY_URL: ${{ secrets.PROXY_URL }}
|
|
|
|
USERNAME: ${{ secrets.USERNAME }}
|
|
|
|
TELEPORT_TOKEN: ${{ secrets.TELEPORT_TOKEN }}
|
2024-06-25 15:00:45 +00:00
|
|
|
REPO_USERNAME: 'SWUSERNAME'
|
2024-12-11 00:18:37 +00:00
|
|
|
REPO_PASSWORD: ${{ needs.issue-token.outputs.token }}
|
|
|
|
|
|
|
|
revoke-token:
|
|
|
|
name: 'Revoke temporary token'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
# if: always()
|
|
|
|
needs:
|
|
|
|
- issue-token
|
|
|
|
- deb-public
|
|
|
|
steps:
|
|
|
|
- name: Revoke Token
|
|
|
|
id: revoke-token
|
|
|
|
uses: signalwire/actions-template/.github/actions/repo-auth-client@main
|
|
|
|
env:
|
|
|
|
TOKEN: ${{ needs.issue-token.outputs.token }}
|
|
|
|
with:
|
|
|
|
mode: revoke
|
2024-06-06 21:59:10 +00:00
|
|
|
|
|
|
|
meta:
|
|
|
|
name: 'Publish build data to meta-repo'
|
2024-12-11 00:18:37 +00:00
|
|
|
if: >-
|
|
|
|
${{
|
|
|
|
(github.event.pull_request.head.repo.full_name == github.repository) &&
|
|
|
|
(
|
|
|
|
(
|
|
|
|
github.event_name != 'pull_request' &&
|
|
|
|
github.event_name != 'workflow_dispatch'
|
|
|
|
) ||
|
|
|
|
(github.event_name == 'workflow_dispatch' && inputs.publish)
|
|
|
|
)
|
|
|
|
}}
|
2024-06-06 21:59:10 +00:00
|
|
|
needs:
|
2024-09-21 11:19:22 +00:00
|
|
|
- deb-public
|
2024-06-06 21:59:10 +00:00
|
|
|
permissions:
|
|
|
|
id-token: write
|
|
|
|
contents: read
|
|
|
|
uses: signalwire/actions-template/.github/workflows/meta-repo-content.yml@main
|
|
|
|
with:
|
2024-09-21 11:19:22 +00:00
|
|
|
META_CONTENT: '/var/www/freeswitch/public/{release,unstable}/${{ github.ref_name }}/${{ github.run_id }}-${{ github.run_number }}'
|
2024-06-06 21:59:10 +00:00
|
|
|
META_REPO: signalwire/bamboo_gha_trigger
|
|
|
|
META_REPO_BRANCH: trigger/freeswitch/${{ github.ref_name }}
|
|
|
|
secrets:
|
|
|
|
GH_BOT_DEPLOY_TOKEN: ${{ secrets.PAT }}
|