updates devcontiner github action to auth against depot with oidc (#547) #13
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: 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: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
name=ghcr.io/${{ github.repository }}/devcontainer | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=match,pattern=devcontainer/v(.*),group=1 | |
sep-tags: "," | |
- name: Update Tags to Fit into devcontainers/cli format | |
id: dcmeta | |
run: | | |
prefix="ghcr.io/${{ github.repository }}/devcontainer" | |
input_list="$DOCKER_METADATA_OUTPUT_TAGS" | |
delimiter="," | |
result_list=$(echo "$input_list" | sed "s|${prefix}:||g") | |
echo "tags=$result_list" >> "$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 | |
uses: devcontainers/[email protected] | |
env: | |
# see: https://github.com/devcontainers/ci/issues/191#issuecomment-1603857155 | |
BUILDX_NO_DEFAULT_ATTESTATIONS: true | |
with: | |
imageName: ghcr.io/${{ github.repository }}/devcontainer | |
imageTag: ${{ steps.dcmeta.outputs.tags }} | |
# cacheFrom: ghcr.io/${{ github.repository }}/devcontainer | |
platform: linux/amd64,linux/arm64 | |
push: always | |
subFolder: .github |