build-devcontainer #16
Workflow file for this run
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: build-devcontainer | |
on: | |
workflow_dispatch: | |
inputs: | |
CLAB_VERSION: | |
description: "Containerlab version" | |
required: false | |
TAG: | |
description: "Additional container image tag" | |
required: false | |
# trigger on published release event | |
# to created the devspace container when the packages are published | |
release: | |
types: | |
- published | |
env: | |
REGISTRY: ghcr.io | |
jobs: | |
devcontainer: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log into registry ${{ env.REGISTRY }} | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ github.repository }} | |
tags: | | |
type=semver,pattern={{version}} | |
type=ref,event=branch | |
type=ref,event=pr | |
# git short commit | |
type=sha | |
# manually set tag | |
type=raw,value=${{ inputs.tag }} | |
- name: Extract tags | |
id: extract-tags | |
run: | | |
TAGS=$(echo '${{ steps.meta.outputs.tags }}' | awk -F: '{print $2}' | paste -sd "," -) | |
echo "TAGS=$TAGS" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Build dev container image | |
uses: devcontainers/ci@v0.3 | |
env: | |
CLAB_VERSION: ${{ inputs.clab_version }} | |
with: | |
imageName: ghcr.io/${{ github.repository }}/clab-devcontainer | |
imageTag: ${{ steps.extract-tags.outputs.tags }} | |
push: always |