From 722fe6912574e289367cf7d9b8755ef367383773 Mon Sep 17 00:00:00 2001 From: "Xuan (Sean) Hu" Date: Sun, 17 Nov 2024 11:26:52 +0800 Subject: [PATCH] fix: build dev container when mounted file changed (#792) --- .github/workflows/devcontainer.yml | 2 ++ .gitlab/workflows/devcontainer.yml | 2 ++ .../workflows/devcontainer.yml.jinja | 2 ++ .../workflows/devcontainer.yml.jinja | 2 ++ 4 files changed, 8 insertions(+) diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml index 486e06e9..35cbe9b5 100644 --- a/.github/workflows/devcontainer.yml +++ b/.github/workflows/devcontainer.yml @@ -6,6 +6,7 @@ on: - .devcontainer/Dockerfile - .devcontainer/Dockerfile.dockerignore - .github/workflows/devcontainer.yml + - Makefile push: branches: - main @@ -13,6 +14,7 @@ on: - .devcontainer/Dockerfile - .devcontainer/Dockerfile.dockerignore - .github/workflows/devcontainer.yml + - Makefile workflow_dispatch: null concurrency: diff --git a/.gitlab/workflows/devcontainer.yml b/.gitlab/workflows/devcontainer.yml index 8a433667..04ad8d04 100644 --- a/.gitlab/workflows/devcontainer.yml +++ b/.gitlab/workflows/devcontainer.yml @@ -13,12 +13,14 @@ dev-container-publish: - .devcontainer/Dockerfile - .devcontainer/Dockerfile.dockerignore - .gitlab/workflows/devcontainer.yml + - Makefile if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push" - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "web" - changes: - .devcontainer/Dockerfile - .devcontainer/Dockerfile.dockerignore - .gitlab/workflows/devcontainer.yml + - Makefile if: $CI_PIPELINE_SOURCE == 'merge_request_event' script: - docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY} diff --git a/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/devcontainer.yml.jinja b/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/devcontainer.yml.jinja index f1d9774f..ce6835fe 100644 --- a/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/devcontainer.yml.jinja +++ b/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/devcontainer.yml.jinja @@ -7,6 +7,7 @@ on: - .devcontainer/Dockerfile - .devcontainer/Dockerfile.dockerignore - .github/workflows/devcontainer.yml + - Makefile push: branches: - main @@ -14,6 +15,7 @@ on: - .devcontainer/Dockerfile - .devcontainer/Dockerfile.dockerignore - .github/workflows/devcontainer.yml + - Makefile workflow_dispatch: null concurrency: diff --git a/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/devcontainer.yml.jinja b/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/devcontainer.yml.jinja index c2ef3ff1..c39fd9bf 100644 --- a/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/devcontainer.yml.jinja +++ b/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/devcontainer.yml.jinja @@ -24,12 +24,14 @@ dev-container-publish: - .devcontainer/Dockerfile - .devcontainer/Dockerfile.dockerignore - .gitlab/workflows/devcontainer.yml + - Makefile if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push" - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "web" - changes: - .devcontainer/Dockerfile - .devcontainer/Dockerfile.dockerignore - .gitlab/workflows/devcontainer.yml + - Makefile if: $CI_PIPELINE_SOURCE == 'merge_request_event' script: - docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}