diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 32fe7261de..605a0e14c4 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -76,6 +76,9 @@ RUN if [ "$BUILD_TYPE" = "release" ]; then \ elif [ "$BUILD_TYPE" = "push" ]; then \ echo "Installing Dojo at commit $DOJO_VERSION"; \ dojoup -c $DOJO_VERSION; \ + elif [ "$BUILD_TYPE" = "workflow_dispatch" ]; then \ + echo "Installing Dojo at commit $DOJO_VERSION"; \ + dojoup -c $DOJO_VERSION; \ else \ echo "Installing latest stable version of Dojo"; \ dojoup; \ diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml index 08672eb7f1..8fc354ebf7 100644 --- a/.github/workflows/devcontainer.yml +++ b/.github/workflows/devcontainer.yml @@ -43,6 +43,7 @@ jobs: if: github.event_name == 'release' run: | echo "DOCKER_TAG=${{ github.event.release.tag_name }}" >> $GITHUB_ENV + echo "DOJO_VERSION=${{ github.event.release.tag_name }}" >> $GITHUB_ENV echo "tag_name=$DOCKER_TAG" >> $GITHUB_OUTPUT - name: Set Docker tag for push event @@ -50,10 +51,13 @@ jobs: run: | SHORT_SHA=$(echo "${{ github.sha }}" | cut -c 1-7) echo "DOCKER_TAG=$SHORT_SHA" >> $GITHUB_ENV + echo "DOJO_VERSION=$SHORT_SHA" >> $GITHUB_ENV - name: Set Docker tag for workflow_dispatch event if: github.event_name == 'workflow_dispatch' run: | + SHORT_SHA=$(echo "${{ github.sha }}" | cut -c 1-7) + echo "DOJO_VERSION=$SHORT_SHA" >> $GITHUB_ENV echo "DOCKER_TAG=${{ inputs.docker_tag }}" >> $GITHUB_ENV - name: Set outputs @@ -64,13 +68,13 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@v2 with: - push: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'release' && startsWith(github.ref, 'refs/tags/')) }} + push: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'release' && startsWith(github.ref, 'refs/tags/')) || github.event_name == 'workflow_dispatch' }} file: .devcontainer/Dockerfile tags: ghcr.io/${{ github.repository }}-dev:latest,ghcr.io/${{ github.repository }}-dev:${{ env.DOCKER_TAG }} build-args: | VARIANT=bookworm BUILD_TYPE=${{ github.event_name }} - DOJO_VERSION=${{ github.event.release.tag_name }} + DOJO_VERSION=${{ env.DOJO_VERSION }} platforms: linux/amd64,linux/arm64 cache-from: type=registry,ref=ghcr.io/${{ github.repository }}-dev:latest