Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added command to run bake and publish in one step #18

Merged
merged 2 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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