Skip to content

Commit 28c866d

Browse files
committed
Refactored with variables
1 parent 2921a93 commit 28c866d

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

.github/workflows/main.yml

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020
packages: write
2121
attestations: write
2222
id-token: write
23+
env:
24+
IMAGE_BASE_NAME: 'throwtheswitch/madsciencelab'
2325

2426
steps:
2527
- name: 'Checkout GitHub Action'
@@ -38,39 +40,45 @@ jobs:
3840
username: ${{ secrets.DOCKERHUB_USERNAME }}
3941
password: ${{ secrets.DOCKERHUB_TOKEN }}
4042

41-
- name: 'Build and push Docker image throwtheswitch/madsciencelab:${{ github.ref_name }}'
43+
- name: 'Build and push Docker image $IMAGE_BASE_NAME:${{ github.ref_name }}'
4244
uses: docker/build-push-action@v6
4345
with:
4446
platforms: linux/amd64,linux/arm64
4547
file: build/standard/docker/Dockerfile
4648
build-args: CONTAINER_VERSION=${{ github.ref_name }}
4749
push: ${{ github.event_name != 'pull_request' }}
48-
tags: mkarlesky/madsciencelab:${{ github.ref_name }}, mkarlesky/madsciencelab:latest
50+
tags: $IMAGE_BASE_NAME:${{ github.ref_name }}, $IMAGE_BASE_NAME:latest
4951

50-
- name: 'Build and push Docker image throwtheswitch/madsciencelab-plugins:${{ github.ref_name }}'
52+
- name: 'Build and push Docker image $IMAGE_BASE_NAME-$VARIANT:${{ github.ref_name }}'
53+
env:
54+
VARIANT: plugins
5155
uses: docker/build-push-action@v6
5256
with:
5357
platforms: linux/amd64,linux/arm64
54-
file: build/plugins/docker/Dockerfile
58+
file: build/$VARIANT/docker/Dockerfile
5559
build-args: CONTAINER_VERSION=${{ github.ref_name }}
5660
push: ${{ github.event_name != 'pull_request' }}
57-
tags: mkarlesky/madsciencelab-plugins:${{ github.ref_name }}, mkarlesky/madsciencelab-plugins:latest
61+
tags: $IMAGE_BASE_NAME-$VARIANT:${{ github.ref_name }}, $IMAGE_BASE_NAME-$VARIANT:latest
5862

59-
- name: 'Build and push Docker image throwtheswitch/madsciencelab-arm-none-eabi:${{ github.ref_name }}'
63+
- name: 'Build and push Docker image $IMAGE_BASE_NAME-$VARIANT:${{ github.ref_name }}'
64+
env:
65+
VARIANT: arm-none-eabi
6066
uses: docker/build-push-action@v6
6167
with:
6268
platforms: linux/amd64,linux/arm64
63-
file: build/arm-none-eabi/docker/Dockerfile
69+
file: build/$VARIANT/docker/Dockerfile
6470
build-args: CONTAINER_VERSION=${{ github.ref_name }}
6571
push: ${{ github.event_name != 'pull_request' }}
66-
tags: mkarlesky/madsciencelab-arm-none-eabi:${{ github.ref_name }}, mkarlesky/madsciencelab-arm-none-eabi:latest
72+
tags: $IMAGE_BASE_NAME-$VARIANT:${{ github.ref_name }}, $IMAGE_BASE_NAME-$VARIANT:latest
6773

68-
- name: 'Build and push Docker image throwtheswitch/madsciencelab-arm-none-eabi-plugins:${{ github.ref_name }}'
74+
- name: 'Build and push Docker image $IMAGE_BASE_NAME-$VARIANT:${{ github.ref_name }}'
75+
env:
76+
VARIANT: arm-none-eabi-plugins
6977
uses: docker/build-push-action@v6
7078
with:
7179
platforms: linux/amd64,linux/arm64
72-
file: build/arm-none-eabi-plugins/docker/Dockerfile
80+
file: build/$VARIANT/docker/Dockerfile
7381
build-args: CONTAINER_VERSION=${{ github.ref_name }}
7482
push: ${{ github.event_name != 'pull_request' }}
75-
tags: mkarlesky/madsciencelab-arm-none-eabi-plugins:${{ github.ref_name }}, mkarlesky/madsciencelab-arm-none-eabi-plugins:latest
83+
tags: $IMAGE_BASE_NAME-$VARIANT:${{ github.ref_name }}, $IMAGE_BASE_NAME-$VARIANT:latest
7684

0 commit comments

Comments
 (0)