Skip to content

Commit

Permalink
Add choice for artifacts
Browse files Browse the repository at this point in the history
Signed-off-by: oguzkaganozt <[email protected]>
  • Loading branch information
oguzkaganozt committed Feb 21, 2024
1 parent d58372b commit 7e8ae2e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
12 changes: 6 additions & 6 deletions .github/actions/docker-build-and-push/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ runs:
set: |
${{ inputs.build-args }}
- name: Build and Publish Release to GitHub Container Registry
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
- name: Build and Publish to GitHub Container Registry
if: ${{ (github.event_name == 'push' && github.ref_type == 'tag' ) || (github.event_name == 'workflow_dispatch' && github.event.inputs.artifact-destination == 'registry') }}
uses: docker/bake-action@v3
with:
push: true
Expand All @@ -115,7 +115,7 @@ runs:
${{ inputs.build-args }}
- name: Build and Save Artifacts
if: ${{ github.event_name == 'workflow_dispatch' }}
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.artifact-destination == 'tarball' }}
uses: docker/bake-action@v3
with:
push: false
Expand All @@ -132,7 +132,7 @@ runs:
runtime.output=type=docker,dest=/tmp/runtime.tar
- name: Upload Artifact - prebuilt
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.save-artifacts == 'true' }}
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.artifact-destination == 'tarball' }}
id: artifact-upload-step-prebuilt
uses: actions/upload-artifact@v4
with:
Expand All @@ -144,7 +144,7 @@ runs:
if-no-files-found: error

- name: Upload Artifact - devel
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.save-artifacts == 'true' }}
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.artifact-destination == 'tarball' }}
id: artifact-upload-step-devel
uses: actions/upload-artifact@v4
with:
Expand All @@ -156,7 +156,7 @@ runs:
if-no-files-found: error

- name: Upload Artifact - runtime
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.save-artifacts == 'true' }}
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.artifact-destination == 'tarball' }}
id: artifact-upload-step-runtime
uses: actions/upload-artifact@v4
with:
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/docker-build-and-push-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ on:
- cron: 0 0 1,15 * *
workflow_dispatch:
inputs:
save-artifacts:
description: Save artifacts to Github Actions
required: true
default: true
type: boolean
artifacts-destination:
type: choice
description: Destination for the artifacts
options:
- registry
- tarball
default: tarball

jobs:
docker-build-and-push-main:
Expand Down

0 comments on commit 7e8ae2e

Please sign in to comment.