Skip to content

Commit

Permalink
feat: Added command to run bake and publish in one step (#18)
Browse files Browse the repository at this point in the history
* feat: Added command to run bake and publish in one step

* feat: updated next tag in readme and in action.yml
  • Loading branch information
Bharadwajshivam28 authored Sep 12, 2024
1 parent 5431793 commit 1df8be2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
7 changes: 6 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,14 @@ inputs:
description: 'Set to true to disable Docker cache'
required: false
default: 'false'
PUBLISH:
description: 'Whether to publish the image'
required: false
default: 'false'

runs:
using: 'docker'
image: 'docker://ghcr.io/clouddrove/enigma:v0.0.9'
image: 'docker://ghcr.io/clouddrove/enigma:v0.0.10'
env:
DOCKER_IMAGE: ${{ inputs.DOCKER_IMAGE }}
DOCKER_TAG: ${{ inputs.DOCKER_TAG }}
Expand All @@ -90,5 +94,6 @@ runs:
BUILD_ARCHITECTURE: ${{ inputs.BUILD_ARCHITECTURE }}
BUILD_ARGS: ${{ inputs.BUILD_ARGS }}
NO_CACHE: ${{ inputs.NO_CACHE }}
PUBLISH: ${{ inputs.PUBLISH }}
args:
- ${{ inputs.command }}
10 changes: 10 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ func main() {
loadDockerEnv()
docker.TagDockerImage()
docker.PushDockerImage()
case "build-publish":
loadDockerEnv()
docker.BuildDockerImage()
docker.ScanDockerImage()
if os.Getenv("PUBLISH") == "true" {
docker.TagDockerImage()
docker.PushDockerImage()
} else {
fmt.Println("Publish is set to false. Skipping publish step.")
}
default:
fmt.Println("Unknown command:", command)
fmt.Println("Commands: init, bake, publish")
Expand Down
4 changes: 2 additions & 2 deletions modules/docker/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
steps:

- name: Build Docker Image
uses: clouddrove/enigma@v0.0.9
uses: clouddrove/enigma@v0.0.10
with:
command: bake
DOCKER_IMAGE: ${{ env.DOCKER_IMAGE }}
Expand All @@ -68,7 +68,7 @@ jobs:
BUILD_ARCHITECTURE: ${{ inputs.BUILD_ARCHITECTURE }}

- name: Publish Docker Image
uses: clouddrove/enigma@v0.0.9
uses: clouddrove/enigma@v0.0.10
with:
command: publish
DOCKER_IMAGE: ${{ env.DOCKER_IMAGE }}
Expand Down

0 comments on commit 1df8be2

Please sign in to comment.