Skip to content

Use devcontainers CLI directly (#548) #14

Use devcontainers CLI directly (#548)

Use devcontainers CLI directly (#548) #14

name: Dev Container Build and Push Image
on:
push:
tags:
- "devcontainer/v*.*.*"
jobs:
devcontainer-build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
packages: write
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Compute tag for devcontainer image
id: meta
run: |
tag="${GITHUB_REF#refs/tags/devcontainer/v}"
echo "tag=$tag" >> "$GITHUB_OUTPUT"
- name: Set up Depot CLI
uses: depot/setup-action@v1
with:
oidc: true
- name: Setup Docker to use Depot
run: depot configure-docker
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and release devcontainer Multi-Platform
run: |
npm install -g @devcontainers/cli
devcontainer build \
--workspace-folder .github \
--image-name ghcr.io/${{ github.repository }}/devcontainer:${{ steps.meta.outputs.tag }} \
--image-name ghcr.io/${{ github.repository }}/devcontainer:latest \
--platform linux/amd64,linux/arm64 \
--push
env:
# see: https://github.com/devcontainers/ci/issues/191#issuecomment-1603857155
BUILDX_NO_DEFAULT_ATTESTATIONS: true