Skip to content

Commit 4706079

Browse files
authored
chore: only build docker images if respective files have changed (#1483)
1 parent db6f989 commit 4706079

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

.github/workflows/main.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,25 @@ jobs:
3838
- name: Build CLI
3939
run: yarn --cwd cli
4040

41+
- name: Build and test webui
42+
run: yarn --cwd webui test
43+
44+
- name: Get all changed webui files
45+
id: changed_webui_files
46+
uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v47.0.0
47+
with:
48+
files: webui/**
49+
4150
- name: Log in to the Container registry
51+
if: steps.changed_webui_files.outputs.any_changed == 'true'
4252
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
4353
with:
4454
registry: ${{ env.REGISTRY }}
4555
username: ${{ github.actor }}
4656
password: ${{ secrets.GITHUB_TOKEN }}
4757

4858
- name: Extract metadata (tags, labels) for Docker
59+
if: steps.changed_webui_files.outputs.any_changed == 'true'
4960
id: meta
5061
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
5162
with:
@@ -57,6 +68,7 @@ jobs:
5768
org.opencontainers.image.title=OpenVSX WebUI
5869
5970
- name: Build and push Web UI Image
71+
if: steps.changed_webui_files.outputs.any_changed == 'true'
6072
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
6173
with:
6274
context: webui
@@ -95,13 +107,15 @@ jobs:
95107
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_API_TOKEN }}
96108

97109
- name: Log in to the Container registry
110+
if: steps.changed_server_files.outputs.any_changed == 'true'
98111
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
99112
with:
100113
registry: ${{ env.REGISTRY }}
101114
username: ${{ github.actor }}
102115
password: ${{ secrets.GITHUB_TOKEN }}
103116

104117
- name: Extract metadata (tags, labels) for Docker
118+
if: steps.changed_server_files.outputs.any_changed == 'true'
105119
id: meta
106120
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
107121
with:
@@ -113,6 +127,7 @@ jobs:
113127
org.opencontainers.image.title=OpenVSX Server
114128
115129
- name: Build and push Server Image
130+
if: steps.changed_server_files.outputs.any_changed == 'true'
116131
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
117132
env:
118133
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_API_TOKEN }}
@@ -122,7 +137,7 @@ jobs:
122137
push: ${{ github.repository_owner == 'eclipse' && github.event_name == 'push' && github.ref == 'refs/heads/master' }}
123138
tags: ${{ steps.meta.outputs.tags }}
124139
labels: ${{ steps.meta.outputs.labels }}
125-
secrets-envs: |
140+
secret-envs: |
126141
"dv-key=DEVELOCITY_ACCESS_KEY"
127142
128143
save-pr-number:

0 commit comments

Comments
 (0)