Build and publish release #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This Source Code Form is subject to the terms of the Mozilla Public | |
# License, v. 2.0. If a copy of the MPL was not distributed with this | |
# file, You can obtain one at https://mozilla.org/MPL/2.0/. | |
name: Publish release | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: "Release Tag" | |
required: true | |
type: string | |
jobs: | |
get_semver: | |
name: Get Semantic Version | |
runs-on: ubuntu-latest | |
outputs: | |
semver: ${{ steps.semver.outputs.semver }} | |
steps: | |
- id: semver | |
env: | |
RELEASE_VERSION: ${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }} | |
run: | | |
if [[ "${RELEASE_VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]]; then | |
echo "semver=${RELEASE_VERSION/v/}" >> "$GITHUB_OUTPUT" | |
else | |
# If ref name does not match semver, default to 0.0.0 | |
# This happens when running from a branch such as main | |
echo "semver=0.0.0" >> "$GITHUB_OUTPUT" | |
# Exit with an error because releases from branches should not be made | |
exit 1 | |
fi | |
# Note: When modifying this job, copy modifications to all other workflow image jobs | |
core_images: | |
needs: get_semver | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- name: gst-web | |
context: addons/gst-web | |
- name: py-build | |
build_args: | | |
PACKAGE_VERSION=${{ needs.get_semver.outputs.semver }} | |
context: . | |
name: ${{ matrix.name }}${{ matrix.version_suffix }} image build & publish | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build & publish ${{ matrix.name }} image | |
uses: ./.github/actions/build_and_publish_image | |
with: | |
build_args: ${{ matrix.build_args }} | |
context: ${{ matrix.context }} | |
dockerfile: ${{ matrix.dockerfile }} | |
platforms: ${{ matrix.platforms }} | |
push: ${{ github.event_name != 'pull_request' }} | |
subproject: ${{ matrix.name }} | |
tags: | | |
ghcr.io/${{ github.repository }}/${{ matrix.name }}:${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}${{ matrix.version_suffix }} | |
ghcr.io/${{ github.repository }}/${{ matrix.name }}:latest${{ matrix.version_suffix }} | |
# Note: When modifying this job, copy modifications to all other workflow image jobs | |
component_images: | |
needs: | |
- get_semver | |
- core_images | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- name: conda | |
build_args: | | |
PACKAGE_VERSION=${{ needs.get_semver.outputs.semver }} | |
PKG_VERSION=${{ needs.get_semver.outputs.semver }} | |
PY_BUILD_IMAGE=ghcr.io/${{ github.repository }}/py-build:${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }} | |
WEB_IMAGE=ghcr.io/${{ github.repository }}/gst-web:${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }} | |
context: addons/conda | |
- name: coturn | |
context: addons/coturn | |
platforms: linux/amd64,linux/arm64 | |
- name: coturn-web | |
context: addons/coturn-web | |
platforms: linux/amd64,linux/arm64 | |
- name: gstreamer | |
version_suffix: -ubuntu20.04 | |
build_args: | | |
DISTRIB_RELEASE=20.04 | |
context: addons/gstreamer | |
- name: gstreamer | |
version_suffix: -ubuntu22.04 | |
build_args: | | |
DISTRIB_RELEASE=22.04 | |
context: addons/gstreamer | |
- name: gstreamer | |
version_suffix: -ubuntu24.04 | |
build_args: | | |
DISTRIB_RELEASE=24.04 | |
context: addons/gstreamer | |
- name: js-interposer | |
version_suffix: -ubuntu20.04 | |
build_args: | | |
DISTRIB_RELEASE=20.04 | |
PKG_NAME=selkies-js-interposer | |
PKG_VERSION=${{ needs.get_semver.outputs.semver }} | |
context: addons/js-interposer | |
dockerfile: Dockerfile.ubuntu_debpkg | |
platforms: linux/amd64,linux/arm64 | |
- name: js-interposer | |
version_suffix: -ubuntu22.04 | |
build_args: | | |
DISTRIB_RELEASE=22.04 | |
PKG_NAME=selkies-js-interposer | |
PKG_VERSION=${{ needs.get_semver.outputs.semver }} | |
context: addons/js-interposer | |
dockerfile: Dockerfile.ubuntu_debpkg | |
platforms: linux/amd64,linux/arm64 | |
- name: js-interposer | |
version_suffix: -ubuntu24.04 | |
build_args: | | |
DISTRIB_RELEASE=24.04 | |
PKG_NAME=selkies-js-interposer | |
PKG_VERSION=${{ needs.get_semver.outputs.semver }} | |
context: addons/js-interposer | |
dockerfile: Dockerfile.ubuntu_debpkg | |
platforms: linux/amd64,linux/arm64 | |
- name: turn-rest | |
context: addons/turn-rest | |
platforms: linux/amd64,linux/arm64 | |
- name: infra-gcp-installer | |
context: infra/gce/installer-image | |
diff: infra/gce | |
name: ${{ matrix.name }}${{ matrix.version_suffix }} image build & publish | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build & publish ${{ matrix.name }} image | |
uses: ./.github/actions/build_and_publish_image | |
with: | |
build_args: ${{ matrix.build_args }} | |
context: ${{ matrix.context }} | |
dockerfile: ${{ matrix.dockerfile }} | |
platforms: ${{ matrix.platforms }} | |
push: ${{ github.event_name != 'pull_request' }} | |
subproject: ${{ matrix.name }} | |
tags: | | |
ghcr.io/${{ github.repository }}/${{ matrix.name }}:${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}${{ matrix.version_suffix }} | |
ghcr.io/${{ github.repository }}/${{ matrix.name }}:latest${{ matrix.version_suffix }} | |
# Note: When modifying this job, copy modifications to all other workflow image jobs | |
example_images: | |
needs: | |
- get_semver | |
- core_images | |
- component_images | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- name: gst-py-example | |
version_suffix: -ubuntu20.04 | |
build_args: | | |
PACKAGE_VERSION=${{ needs.get_semver.outputs.semver }} | |
DISTRIB_RELEASE=20.04 | |
GSTREAMER_BASE_IMAGE_RELEASE=${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }} | |
PY_BUILD_IMAGE=ghcr.io/${{ github.repository }}/py-build:${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }} | |
WEB_IMAGE=ghcr.io/${{ github.repository }}/gst-web:${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }} | |
JS_BASE_IMAGE_RELEASE=${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }} | |
JS_BASE_IMAGE=ghcr.io/${{ github.repository }}/js-interposer | |
context: addons/example | |
- name: gst-py-example | |
version_suffix: -ubuntu22.04 | |
build_args: | | |
PACKAGE_VERSION=${{ needs.get_semver.outputs.semver }} | |
DISTRIB_RELEASE=22.04 | |
GSTREAMER_BASE_IMAGE_RELEASE=${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }} | |
PY_BUILD_IMAGE=ghcr.io/${{ github.repository }}/py-build:${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }} | |
WEB_IMAGE=ghcr.io/${{ github.repository }}/gst-web:${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }} | |
JS_BASE_IMAGE_RELEASE=${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }} | |
JS_BASE_IMAGE=ghcr.io/${{ github.repository }}/js-interposer | |
context: addons/example | |
- name: gst-py-example | |
version_suffix: -ubuntu24.04 | |
build_args: | | |
PACKAGE_VERSION=${{ needs.get_semver.outputs.semver }} | |
DISTRIB_RELEASE=24.04 | |
GSTREAMER_BASE_IMAGE_RELEASE=${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }} | |
PY_BUILD_IMAGE=ghcr.io/${{ github.repository }}/py-build:${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }} | |
WEB_IMAGE=ghcr.io/${{ github.repository }}/gst-web:${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }} | |
JS_BASE_IMAGE_RELEASE=${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }} | |
JS_BASE_IMAGE=ghcr.io/${{ github.repository }}/js-interposer | |
context: addons/example | |
name: ${{ matrix.name }}${{ matrix.version_suffix }} image build & publish | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build & publish ${{ matrix.name }} image | |
uses: ./.github/actions/build_and_publish_image | |
with: | |
build_args: ${{ matrix.build_args }} | |
context: ${{ matrix.context }} | |
dockerfile: ${{ matrix.dockerfile }} | |
platforms: ${{ matrix.platforms }} | |
push: ${{ github.event_name != 'pull_request' }} | |
subproject: ${{ matrix.name }} | |
tags: | | |
ghcr.io/${{ github.repository }}/${{ matrix.name }}:${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}${{ matrix.version_suffix }} | |
ghcr.io/${{ github.repository }}/${{ matrix.name }}:latest${{ matrix.version_suffix }} | |
upload_artifacts: | |
needs: | |
- get_semver | |
- core_images | |
- component_images | |
- example_images | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name != 'pull_request' }} | |
env: | |
TMPDIR: /tmp | |
strategy: | |
matrix: | |
include: | |
- name: conda | |
source: /opt/selkies-gstreamer-conda.tar.gz | |
target: selkies-gstreamer-portable-${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_amd64.tar.gz | |
- name: gst-web | |
source: /opt/gst-web.tar.gz | |
target: selkies-gstreamer-web_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}.tar.gz | |
- name: gstreamer | |
version_suffix: -ubuntu20.04 | |
source: /opt/selkies-gstreamer-latest.tar.gz | |
target: gstreamer-selkies_gpl_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_ubuntu20.04_amd64.tar.gz | |
- name: gstreamer | |
version_suffix: -ubuntu22.04 | |
source: /opt/selkies-gstreamer-latest.tar.gz | |
target: gstreamer-selkies_gpl_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_ubuntu22.04_amd64.tar.gz | |
- name: gstreamer | |
version_suffix: -ubuntu24.04 | |
source: /opt/selkies-gstreamer-latest.tar.gz | |
target: gstreamer-selkies_gpl_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_ubuntu24.04_amd64.tar.gz | |
- name: js-interposer | |
version_suffix: -ubuntu20.04 | |
suffix: -deb | |
source: /opt/selkies-js-interposer_${{ needs.get_semver.outputs.semver }}.deb | |
target: selkies-js-interposer_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_ubuntu20.04_amd64.deb | |
- name: js-interposer | |
version_suffix: -ubuntu22.04 | |
suffix: -deb | |
source: /opt/selkies-js-interposer_${{ needs.get_semver.outputs.semver }}.deb | |
target: selkies-js-interposer_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_ubuntu22.04_amd64.deb | |
- name: js-interposer | |
version_suffix: -ubuntu24.04 | |
suffix: -deb | |
source: /opt/selkies-js-interposer_${{ needs.get_semver.outputs.semver }}.deb | |
target: selkies-js-interposer_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_ubuntu24.04_amd64.deb | |
- name: js-interposer | |
version_suffix: -ubuntu20.04 | |
suffix: -deb | |
source: /opt/selkies-js-interposer_${{ needs.get_semver.outputs.semver }}.deb | |
target: selkies-js-interposer_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_ubuntu20.04_arm64.deb | |
platforms: linux/arm64 | |
- name: js-interposer | |
version_suffix: -ubuntu22.04 | |
suffix: -deb | |
source: /opt/selkies-js-interposer_${{ needs.get_semver.outputs.semver }}.deb | |
target: selkies-js-interposer_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_ubuntu22.04_arm64.deb | |
platforms: linux/arm64 | |
- name: js-interposer | |
version_suffix: -ubuntu24.04 | |
suffix: -deb | |
source: /opt/selkies-js-interposer_${{ needs.get_semver.outputs.semver }}.deb | |
target: selkies-js-interposer_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_ubuntu24.04_arm64.deb | |
platforms: linux/arm64 | |
- name: js-interposer | |
version_suffix: -ubuntu20.04 | |
suffix: -tar.gz | |
source: /opt/selkies-js-interposer_${{ needs.get_semver.outputs.semver }}.tar.gz | |
target: selkies-js-interposer_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_ubuntu20.04_amd64.tar.gz | |
- name: js-interposer | |
version_suffix: -ubuntu22.04 | |
suffix: -tar.gz | |
source: /opt/selkies-js-interposer_${{ needs.get_semver.outputs.semver }}.tar.gz | |
target: selkies-js-interposer_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_ubuntu22.04_amd64.tar.gz | |
- name: js-interposer | |
version_suffix: -ubuntu24.04 | |
suffix: -tar.gz | |
source: /opt/selkies-js-interposer_${{ needs.get_semver.outputs.semver }}.tar.gz | |
target: selkies-js-interposer_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_ubuntu24.04_amd64.tar.gz | |
- name: js-interposer | |
version_suffix: -ubuntu20.04 | |
suffix: -tar.gz | |
source: /opt/selkies-js-interposer_${{ needs.get_semver.outputs.semver }}.tar.gz | |
target: selkies-js-interposer_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_ubuntu20.04_arm64.tar.gz | |
platforms: linux/arm64 | |
- name: js-interposer | |
version_suffix: -ubuntu22.04 | |
suffix: -tar.gz | |
source: /opt/selkies-js-interposer_${{ needs.get_semver.outputs.semver }}.tar.gz | |
target: selkies-js-interposer_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_ubuntu22.04_arm64.tar.gz | |
platforms: linux/arm64 | |
- name: js-interposer | |
version_suffix: -ubuntu24.04 | |
suffix: -tar.gz | |
source: /opt/selkies-js-interposer_${{ needs.get_semver.outputs.semver }}.tar.gz | |
target: selkies-js-interposer_${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}_ubuntu24.04_arm64.tar.gz | |
platforms: linux/arm64 | |
- name: py-build | |
source: /opt/pypi/dist/selkies_gstreamer-${{ needs.get_semver.outputs.semver }}-py3-none-any.whl | |
target: selkies_gstreamer-${{ needs.get_semver.outputs.semver }}-py3-none-any.whl | |
name: ${{ matrix.name }}${{ matrix.version_suffix }}${{ matrix.suffix }}_${{ matrix.platforms || 'linux/amd64' }} release artifact extraction & upload | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log into registry ghcr.io | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
- name: ${{ matrix.name }}${{ matrix.version_suffix }}${{ matrix.suffix }}_${{ matrix.platforms || 'linux/amd64' }} release artifact extraction | |
run: | | |
docker container create --name=copy --platform="${{ matrix.platforms || 'linux/amd64' }}" "ghcr.io/${{ github.repository }}/${{ matrix.name }}:${{ github.event_name != 'pull_request' && github.event.inputs.tag || 'main' }}${{ matrix.version_suffix }}" | |
TARGET_PATH="${{ env.TMPDIR }}/${{ matrix.target }}" | |
docker container cp "copy:${{ matrix.source }}" "${TARGET_PATH}" | |
if [ -d "${TARGET_PATH}" ]; then | |
SOURCE_DIRNAME=$(echo "${{ matrix.source }}" | sed 's:.*/::') | |
cd "${{ env.TMPDIR }}" && mv -f "${TARGET_PATH}" "${SOURCE_DIRNAME}" | |
tar -czvf "temp.tar.gz" "${SOURCE_DIRNAME}" && rm -rf "${SOURCE_DIRNAME}" && mv -f "temp.tar.gz" "${TARGET_PATH}" | |
fi | |
docker container rm --force --volumes copy | |
echo "release_arch=$(echo ${{ matrix.platforms || 'linux/amd64' }} | sed -e 's/\//\-/')" >> "$GITHUB_ENV" | |
- name: ${{ matrix.name }}${{ matrix.version_suffix }}${{ matrix.suffix }}_${{ matrix.platforms || 'linux/amd64' }} upload | |
uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: error | |
overwrite: true | |
name: ${{ matrix.name }}${{ matrix.version_suffix }}${{ matrix.suffix }}_${{ env.release_arch }} | |
path: ${{ env.TMPDIR }}/${{ matrix.target }} | |
create_release: | |
needs: | |
- get_semver | |
- core_images | |
- component_images | |
- example_images | |
- upload_artifacts | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name != 'pull_request' }} | |
env: | |
TMPDIR: /tmp | |
name: Create v${{ needs.get_semver.outputs.semver }} draft release | |
steps: | |
- name: Download v${{ needs.get_semver.outputs.semver }} artifacts | |
id: artifact | |
uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
path: ${{ env.TMPDIR }}/artifacts | |
- name: Create v${{ needs.get_semver.outputs.semver }} draft release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: "Release v${{ needs.get_semver.outputs.semver }}" | |
tag_name: v${{ needs.get_semver.outputs.semver }} | |
append_body: true | |
body: "**By downloading the GStreamer build files or the portable distribution, you acknowledge, agree, and adhere to the terms of works licensed under (L)GPLv2, (L)GPLv3, and https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvrtc/LICENSE.txt licenses, as well as other terms of intellectual property, including but not limited to patents.**" | |
draft: true | |
generate_release_notes: true | |
fail_on_unmatched_files: true | |
files: | | |
${{ steps.artifact.outputs.download-path }}/* |