Skip to content

Commit 0763f8a

Browse files
Saurav AgarwalSaurav Agarwal
authored andcommitted
Make dockerhub optional
1 parent 50fb188 commit 0763f8a

File tree

2 files changed

+30
-9
lines changed

2 files changed

+30
-9
lines changed

.github/docker-base-action/action.yml

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ inputs:
44
base_tag:
55
description: 'Base tag for docker'
66
required: true
7-
dockerhub_username:
7+
dockerhub:
88
required: true
9+
default: false
10+
dockerhub_username:
11+
required: false
912
dockerhub_token:
10-
required: true
13+
required: false
1114
github_token:
1215
required: true
1316

@@ -21,6 +24,7 @@ runs:
2124
echo "REPO_NAME=${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/}" >> $GITHUB_ENV
2225
shell: bash
2326
- name: Login to Docker Hub
27+
if: ${{ inputs.dockerhub }} == true
2428
uses: docker/login-action@v3
2529
with:
2630
username: ${{ inputs.dockerhub_username }}
@@ -36,14 +40,34 @@ runs:
3640
- name: Set up Docker Buildx
3741
uses: docker/setup-buildx-action@v3
3842
- name: Docker meta
39-
id: meta
43+
if: ${{ inputs.dockerhub }}
44+
id: meta_with_dockerhub
4045
uses: docker/metadata-action@v5
4146
with:
4247
images: |
4348
${{ inputs.dockerhub_username }}/${{ env.REPO_NAME }}
4449
ghcr.io/${{ github.repository }}
45-
tags: type=edge,pattern={{version}},suffix=-${{ inputs.base_tag }}
50+
tags: type=semver,pattern={{version}},suffix=-${{ inputs.base_tag }}
51+
- name: Build and push
52+
if: ${{ inputs.dockerhub }}
53+
uses: docker/build-push-action@v5
54+
with:
55+
provenance: false
56+
platforms: linux/amd64
57+
file: setup_utils/docker/Dockerfile
58+
build-args: BASE_TAG=${{ inputs.base_tag }}
59+
push: true
60+
tags: ${{ steps.meta_with_dockerhub.outputs.tags }}
61+
labels: ${{ steps.meta_with_dockerhub.outputs.labels }}
62+
- name: Docker meta
63+
if: ${{ inputs.dockerhub }} == false
64+
id: meta
65+
uses: docker/metadata-action@v5
66+
with:
67+
images: ghcr.io/${{ github.repository }}
68+
tags: type=semver,pattern={{version}},suffix=-${{ inputs.base_tag }}
4669
- name: Build and push
70+
if: ${{ inputs.dockerhub }} == false
4771
uses: docker/build-push-action@v5
4872
with:
4973
provenance: false

.github/workflows/ghaction-doxygen-ghpages.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
on:
2-
# release:
3-
# types: [published]
4-
push:
5-
branches:
6-
- main
2+
release:
3+
types: [published]
74
permissions:
85
contents: write
96

0 commit comments

Comments
 (0)