6969 runs-on : ubuntu-latest
7070 permissions :
7171 packages : write
72+ outputs :
73+ image : ${{ steps.image.outputs.name }}
7274 steps :
7375 - name : Checkout repository
7476 uses : actions/checkout@v6
@@ -83,13 +85,20 @@ jobs:
8385 username : ${{ github.actor }}
8486 password : ${{ secrets.GITHUB_TOKEN }}
8587
88+ - name : Compute image path
89+ id : image
90+ run : |
91+ repo_lower=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')
92+ image="ghcr.io/$repo_lower/devcontainer:${{ github.sha }}"
93+ echo "name=$image" >> $GITHUB_OUTPUT
94+
8695 - name : Build and push devcontainer image
8796 uses : docker/build-push-action@v6
8897 with :
8998 context : .
9099 file : .devcontainer/Dockerfile
91100 push : true
92- tags : ghcr.io/ ${{ github.repository }}/devcontainer:${{ github.sha }}
101+ tags : ${{ steps.image.outputs.name }}
93102 cache-from : type=gha
94103 cache-to : type=gha,mode=max
95104
98107 needs : build-devcontainer
99108 runs-on : ubuntu-latest
100109 container :
101- image : ghcr.io/ ${{ github.repository }}/ devcontainer:${{ github.sha }}
110+ image : ${{ needs.build- devcontainer.outputs.image }}
102111 steps :
103112 - name : Checkout repository
104113 uses : actions/checkout@v6
@@ -119,7 +128,7 @@ jobs:
119128 needs : build-devcontainer
120129 runs-on : ubuntu-latest
121130 container :
122- image : ghcr.io/ ${{ github.repository }}/ devcontainer:${{ github.sha }}
131+ image : ${{ needs.build- devcontainer.outputs.image }}
123132 steps :
124133 - name : Checkout repository
125134 uses : actions/checkout@v6
0 commit comments