Manual workflow #14
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
name: Manual workflow | |
on: | |
workflow_dispatch: | |
inputs: | |
image: | |
description: 'Image to build e.g. gpu-notebook' | |
required: true | |
default: 'gpu-notebook' | |
tag: | |
description: 'Tag to build e.g. cuda11.8.0-ubuntu22.04' | |
required: true | |
default: 'cuda11.8.0-ubuntu22.04' | |
registry: | |
description: 'Registry to publish e.g. quay.io or ghcr.io' | |
required: true | |
default: 'quay.io' | |
jobs: | |
setup: | |
name: Setup | |
runs-on: ubuntu-latest | |
outputs: | |
owner: ${{ steps.setup_image.outputs.owner }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup image | |
id: setup_image | |
run: | | |
if [ "$GITHUB_EVENT_NAME" = "pull_request" ] | |
then | |
GH_BRANCH=$GITHUB_BASE_REF | |
else | |
GH_BRANCH=${GITHUB_REF##*/} | |
fi | |
echo "::set-output name=owner::ghcr.io/b-it-bots/docker" | |
publish-gpu-notebook: | |
name: Build and publish gpu-notebook | |
needs: setup | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: $${{ needs.setup.inputs.registry }} | |
username: ${{ secrets.GH_USERNAME }} | |
password: ${{ secrets.GH_TOKEN }} | |
- name: Build and deploy image | |
id: build_and_deploy_image | |
run: | | |
OWNER=${{ needs.setup.outputs.owner }} | |
REGISTRY=${{ needs.setup.inputs.registry }} | |
IMAGE=${{ github.event.inputs.image }} | |
TAG=${{ github.event.inputs.tag }} | |
bash build_and_publish.sh --registry $REGISTRY --publish "all" --tag $TAG --image $IMAGE | |
- name: Docker image list | |
run: docker images | |