Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workflows for building+publishing images & creating releases #23

Merged
merged 27 commits into from
Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
226b89f
Copy workflows & action from gstreamer
JanCVanB Jan 24, 2022
0fc9308
Add newlines for formatting
JanCVanB Jan 24, 2022
1b1d846
Add name
JanCVanB Jan 24, 2022
92a9958
Add description
JanCVanB Jan 24, 2022
37e5df9
Alphabetize inputs
JanCVanB Jan 24, 2022
8ef47f4
Add input descriptions
JanCVanB Jan 24, 2022
ca8add5
Rename & simplify release creator
JanCVanB Jan 24, 2022
977971e
Replace gstreamer logic with vdi template logic
JanCVanB Jan 24, 2022
4059f68
Reuse "all images" workflow for automation changes
JanCVanB Jan 24, 2022
f29140b
Generalize "changed images" workflow for future reuse
JanCVanB Jan 25, 2022
db6024f
Add WebRTC image build/publish automation
JanCVanB Jan 25, 2022
eac787f
Remove automation templates
JanCVanB Jan 25, 2022
d245db7
Default to use caching
JanCVanB Jan 25, 2022
74ec6c5
Add build/publish automation for images that are simple in cloudbuild
JanCVanB Jan 25, 2022
57ba5b8
Add app-streaming images build/publish automation
JanCVanB Jan 25, 2022
bd2cfe2
Add app-proxy image build/publish automation
JanCVanB Jan 25, 2022
249dd87
Remove automatic triggers for untested image workflows
JanCVanB Jan 25, 2022
82e5fd5
Overwrite remaining stubs
JanCVanB Jan 25, 2022
d7d0ece
Simplify image names
JanCVanB Jan 26, 2022
e5de8b2
Fix alphabetization mistake
JanCVanB Jan 26, 2022
56fd5ea
Improve app-streaming image versioning
JanCVanB Jan 26, 2022
a15c9d0
Fix copy/paste typos
JanCVanB Jan 26, 2022
6ccb469
Improve on-manual trigger descriptions
JanCVanB Jan 26, 2022
80ec5cb
Simplify triggers & authentication
JanCVanB Jan 26, 2022
8ae4599
Simplify image builder job names
JanCVanB Jan 26, 2022
573d6d9
Clone Xpra submodule when building xpra image
JanCVanB Jan 26, 2022
55408d2
Mark releases as drafts, for manual completion
JanCVanB Jan 27, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/actions/build_and_publish_image/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Build & publish an image

description: Build an image from source, then publish it to GHCR

inputs:
build_args:
description: '`ARG=value`s to pass to `docker build`'
required: false
dockerfile:
description: Image source file name
default: 'Dockerfile'
required: false
github_token:
description: A GitHub personal access token (PAT) that matches the username
required: true
github_username:
description: The GitHub user as whom to run this action
required: true
image_source_directory:
description: Image source directory path
required: true
image_name:
description: The basename for all image tags, such as "image" in "ghcr.io/user/repo/image:latest"
required: true
image_version_1:
description: A version for all image tags, such as "foo" in "ghcr.io/user/repo/image:foo"
required: true
image_version_2:
description: Another version for all image tags, such as "bar" in "ghcr.io/user/repo/image:bar"
required: false
image_version_suffix:
description: A suffix for all image tags, such as "-baz" in "ghcr.io/user/repo/image:foo-baz"
required: false
use_cache:
default: "true"
description: Use cached layers from pre-published image with tag 1 (true/false)
required: false

runs:
using: composite
steps:
- shell: bash
run: |
set -x

echo ${{ inputs.github_token }} | docker login ghcr.io -u ${{ inputs.github_username }} --password-stdin
export BUILD_ARGS=""
if [[ -n "${{ inputs.build_args }}" ]]; then
IFS=";" read -ra args <<< "${{ inputs.build_args }}"
for arg in ${args[@]}; do BUILD_ARGS+="--build-arg $arg "; done
fi

export IMAGE_TAG_URL_PREFIX=ghcr.io/selkies-project/selkies-vdi/
export IMAGE_TAG_1="${IMAGE_TAG_URL_PREFIX}${{ inputs.image_name }}:${{ inputs.image_version_1 }}${{ inputs.image_version_suffix }}"
if [[ "${{ inputs.use_cache }}" == "true" ]]; then
docker pull $IMAGE_TAG_1 || true
(cd ${{ inputs.image_source_directory }} && docker build $BUILD_ARGS -f ${{ inputs.dockerfile }} --cache-from $IMAGE_TAG_1 -t $IMAGE_TAG_1 .)
else
(cd ${{ inputs.image_source_directory }} && docker build $BUILD_ARGS -f ${{ inputs.dockerfile }} -t $IMAGE_TAG_1 .)
fi
docker push $IMAGE_TAG_1

if [ '${{ inputs.image_version_2 }}' != '' ]; then
export IMAGE_TAG_2="${IMAGE_TAG_URL_PREFIX}${{ inputs.image_name }}:${{ inputs.image_version_2 }}${{ inputs.image_version_suffix }}"
docker tag $IMAGE_TAG_1 $IMAGE_TAG_2
docker push $IMAGE_TAG_2
fi
222 changes: 218 additions & 4 deletions .github/workflows/build_and_publish_all_images.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,224 @@
name: Stub
name: Build & publish all images

on: workflow_call
on:
workflow_call:
inputs:
image_version_1:
description: A version for all image tags, such as "foo" in "ghcr.io/user/repo/image:foo"
required: true
type: string
image_version_2:
description: Another version for all image tags, such as "bar" in "ghcr.io/user/repo/image:bar"
required: false
type: string

env:
github_token: ${{ secrets.GITHUB_TOKEN }}
github_username: $GITHUB_ACTOR

jobs:

stub:
app_proxy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build & publish image
uses: ./.github/actions/build_and_publish_image
with:
github_token: $github_token
github_username: $github_username
image_name: app-proxy
image_source_directory: images/app-proxy
image_version_1: ${{ inputs.image_version_1 }}
image_version_2: ${{ inputs.image_version_2 }}

app_streaming_bionic:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build & publish image
uses: ./.github/actions/build_and_publish_image
with:
dockerfile: Dockerfile.bionic
github_token: $github_token
github_username: $github_username
image_name: app-streaming
image_source_directory: images/app-streaming
image_version_1: ${{ inputs.image_version_1 }}
image_version_2: ${{ inputs.image_version_2 }}
image_version_suffix: -bionic

app_streaming_buster:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build & publish image
uses: ./.github/actions/build_and_publish_image
with:
github_token: $github_token
github_username: $github_username
image_name: app-streaming
image_source_directory: images/app-streaming
image_version_1: ${{ inputs.image_version_1 }}
image_version_2: ${{ inputs.image_version_2 }}
image_version_suffix: -buster

app_streaming_focal:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build & publish image
uses: ./.github/actions/build_and_publish_image
with:
dockerfile: Dockerfile.focal
github_token: $github_token
github_username: $github_username
image_name: app-streaming
image_source_directory: images/app-streaming
image_version_1: ${{ inputs.image_version_1 }}
image_version_2: ${{ inputs.image_version_2 }}
image_version_suffix: -focal

app_streaming_focal_cuda:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build & publish image
uses: ./.github/actions/build_and_publish_image
with:
dockerfile: Dockerfile.focal-cuda
github_token: $github_token
github_username: $github_username
image_name: app-streaming
image_source_directory: images/app-streaming
image_version_1: ${{ inputs.image_version_1 }}
image_version_2: ${{ inputs.image_version_2 }}
image_version_suffix: -focal-cuda

desktop:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build & publish image
uses: ./.github/actions/build_and_publish_image
with:
github_token: $github_token
github_username: $github_username
image_name: desktop
image_source_directory: images/desktop
image_version_1: ${{ inputs.image_version_1 }}
image_version_2: ${{ inputs.image_version_2 }}

pulseaudio:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build & publish image
uses: ./.github/actions/build_and_publish_image
with:
github_token: $github_token
github_username: $github_username
image_name: pulseaudio
image_source_directory: images/pulseaudio
image_version_1: ${{ inputs.image_version_1 }}
image_version_2: ${{ inputs.image_version_2 }}

squid_proxy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build & publish image
uses: ./.github/actions/build_and_publish_image
with:
github_token: $github_token
github_username: $github_username
image_name: squid-proxy
image_source_directory: images/squid-proxy
image_version_1: ${{ inputs.image_version_1 }}
image_version_2: ${{ inputs.image_version_2 }}

tinyfilemanager:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build & publish image
uses: ./.github/actions/build_and_publish_image
with:
github_token: $github_token
github_username: $github_username
image_name: tinyfilemanager
image_source_directory: images/tinyfilemanager
image_version_1: ${{ inputs.image_version_1 }}
image_version_2: ${{ inputs.image_version_2 }}

uinput_device_plugin:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build & publish image
uses: ./.github/actions/build_and_publish_image
with:
github_token: $github_token
github_username: $github_username
image_name: uinput-device-plugin
image_source_directory: images/uinput-device-plugin
image_version_1: ${{ inputs.image_version_1 }}
image_version_2: ${{ inputs.image_version_2 }}

watchdog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build & publish image
uses: ./.github/actions/build_and_publish_image
with:
github_token: $github_token
github_username: $github_username
image_name: watchdog
image_source_directory: images/watchdog
image_version_1: ${{ inputs.image_version_1 }}
image_version_2: ${{ inputs.image_version_2 }}

webrtc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build & publish image
uses: ./.github/actions/build_and_publish_image
with:
github_token: $github_token
github_username: $github_username
image_name: webrtc
image_source_directory: images/webrtc
image_version_1: ${{ inputs.image_version_1 }}
image_version_2: ${{ inputs.image_version_2 }}

xpra:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Build & publish image
uses: ./.github/actions/build_and_publish_image
with:
github_token: $github_token
github_username: $github_username
image_name: xpra
image_source_directory: images/xpra
image_version_1: ${{ inputs.image_version_1 }}
image_version_2: ${{ inputs.image_version_2 }}

xserver:
runs-on: ubuntu-latest
steps:
- run: echo 'stub'
- uses: actions/checkout@v2
- name: Build & publish image
uses: ./.github/actions/build_and_publish_image
with:
github_token: $github_token
github_username: $github_username
image_name: xserver
image_source_directory: images/xserver
image_version_1: ${{ inputs.image_version_1 }}
image_version_2: ${{ inputs.image_version_2 }}
Loading