Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): add suffix to prebuild devcontainer image and update main devcontainer.json after pipeline run #1593

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Loading