Skip to content

Commit

Permalink
chore(ci): add suffix to prebuild devcontainer image and update main …
Browse files Browse the repository at this point in the history
…devcontainer.json after pipeline run
  • Loading branch information
pascalbreuninger committed Jan 24, 2025
1 parent 13ccbf0 commit d4dfecd
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions .github/workflows/build-devcontainer-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
permissions:
packages: "write"
contents: "read"
contents: "write"
steps:
- name: Checkout
id: checkout
Expand Down Expand Up @@ -55,10 +55,28 @@ jobs:
docker tag $ID ghcr.io/loft-sh/devpod:dev-$ARCH
docker push ghcr.io/loft-sh/devpod:dev-$ARCH
done
SUFFIX="${{github.sha}}"
IMAGE_NAME="devpod:dev-$SUFFIX"
echo "IMAGE_NAME=$IMAGE_NAME" >> $GITHUB_ENV
# Combine into multi-arch image
docker manifest create ghcr.io/loft-sh/devpod:dev \
docker manifest create ghcr.io/loft-sh/$IMAGE_NAME \
--amend ghcr.io/loft-sh/devpod:dev-amd64 \
--amend ghcr.io/loft-sh/devpod:dev-arm64
docker manifest push ghcr.io/loft-sh/devpod:dev
docker manifest push ghcr.io/loft-sh/$IMAGE_NAME
- name: Update devcontainer.json
if: ${{ success() }}
run: |
sed -i "s|\(\"image\": \"\).*|\1ghcr.io/loft-sh/${IMAGE_NAME}\",|" .devcontainer/devcontainer.json
- name: Create Pull Request
if: ${{ success() }}
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Update devcontainer image to ghcr.io/loft-sh/${{ env.IMAGE_NAME }}"
title: "Update devcontainer image"
body: "This PR updates the devcontainer image to ghcr.io/loft-sh/${{ env.IMAGE_NAME }}"
branch: "update-devcontainer-${{ github.sha }}"
base: "main"

0 comments on commit d4dfecd

Please sign in to comment.