Skip to content

Commit 2590db8

Browse files
committed
Update workflow to take in inputs for single image build
1 parent d2a281a commit 2590db8

1 file changed

Lines changed: 41 additions & 12 deletions

File tree

.github/workflows/build-images.yml

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,27 @@ name: Build and Push Dev Images
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
image:
7+
description: 'Image to build (leave empty for all)'
8+
required: false
9+
type: choice
10+
options:
11+
- ''
12+
- base
13+
- go
14+
- rust
15+
- java
16+
- dotnet
17+
- ruby
18+
version:
19+
description: 'Version override (only used when single image selected)'
20+
required: false
21+
type: string
22+
tag:
23+
description: 'Tag override (only used when single image selected)'
24+
required: false
25+
type: string
526

627
env:
728
REGISTRY: docker.io
@@ -13,65 +34,73 @@ jobs:
1334
fail-fast: false
1435
matrix:
1536
include:
16-
# Base image (Node + Python only)
1737
- repo: dev-base
38+
key: base
1839
tag: "1"
19-
# Go
2040
- repo: dev-go
41+
key: go
2142
tag: "1.23"
2243
go: "true"
2344
go_version: "1.23.4"
24-
# Rust
2545
- repo: dev-rust
46+
key: rust
2647
tag: "1.83"
2748
rust: "true"
2849
rust_version: "1.83.0"
29-
# Java
3050
- repo: dev-java
51+
key: java
3152
tag: "21"
3253
java: "true"
3354
java_version: "21"
34-
# .NET
3555
- repo: dev-dotnet
56+
key: dotnet
3657
tag: "8.0"
3758
dotnet: "true"
3859
dotnet_version: "8.0"
39-
# Ruby
4060
- repo: dev-ruby
61+
key: ruby
4162
tag: "3.3"
4263
ruby: "true"
4364
ruby_version: "3.3"
4465

4566
steps:
67+
- name: Skip if not selected
68+
if: ${{ inputs.image != '' && inputs.image != matrix.key }}
69+
run: echo "Skipping ${{ matrix.key }}" && exit 0
70+
4671
- uses: actions/checkout@v4
72+
if: ${{ inputs.image == '' || inputs.image == matrix.key }}
4773

4874
- name: Set up Docker Buildx
75+
if: ${{ inputs.image == '' || inputs.image == matrix.key }}
4976
uses: docker/setup-buildx-action@v3
5077

5178
- name: Login to DockerHub
79+
if: ${{ inputs.image == '' || inputs.image == matrix.key }}
5280
uses: docker/login-action@v3
5381
with:
5482
username: ${{ secrets.DOCKERHUB_USERNAME }}
5583
password: ${{ secrets.DOCKERHUB_TOKEN }}
5684

5785
- name: Build and push
86+
if: ${{ inputs.image == '' || inputs.image == matrix.key }}
5887
uses: docker/build-push-action@v6
5988
with:
6089
context: .
6190
file: ./Dockerfile
6291
push: true
6392
platforms: linux/amd64
64-
tags: warpdotdev/${{ matrix.repo }}:${{ matrix.tag }}
93+
tags: warpdotdev/${{ matrix.repo }}:${{ inputs.tag || matrix.tag }}
6594
build-args: |
6695
INSTALL_RUST=${{ matrix.rust || 'false' }}
6796
INSTALL_GO=${{ matrix.go || 'false' }}
6897
INSTALL_JAVA=${{ matrix.java || 'false' }}
6998
INSTALL_DOTNET=${{ matrix.dotnet || 'false' }}
7099
INSTALL_RUBY=${{ matrix.ruby || 'false' }}
71-
GO_VERSION=${{ matrix.go_version || '1.23.4' }}
72-
RUST_VERSION=${{ matrix.rust_version || '1.83.0' }}
73-
JAVA_VERSION=${{ matrix.java_version || '21' }}
74-
DOTNET_VERSION=${{ matrix.dotnet_version || '8.0' }}
75-
RUBY_VERSION=${{ matrix.ruby_version || '3.3' }}
100+
GO_VERSION=${{ matrix.key == 'go' && inputs.version || matrix.go_version || '1.23.4' }}
101+
RUST_VERSION=${{ matrix.key == 'rust' && inputs.version || matrix.rust_version || '1.85.0' }}
102+
JAVA_VERSION=${{ matrix.key == 'java' && inputs.version || matrix.java_version || '21' }}
103+
DOTNET_VERSION=${{ matrix.key == 'dotnet' && inputs.version || matrix.dotnet_version || '8.0' }}
104+
RUBY_VERSION=${{ matrix.key == 'ruby' && inputs.version || matrix.ruby_version || '3.3' }}
76105
cache-from: type=gha
77106
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)