Skip to content

Commit

Permalink
Add caching capabilities to build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Tostti committed Mar 27, 2024
1 parent 5355884 commit 2f843bd
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,22 @@ on:
required: true
default: ''
type: string
CACHE:
description: 'Cache the artifacts instead of uploading'
required: false
default: false
type: boolean
workflow_dispatch:
inputs:
CHECKOUT_TO: # This is the branch to checkout to. Defaults to 'master'
description: 'The branch/tag/commit to checkout to'
required: true
default: ''

CACHE:
description: 'Cache the artifacts instead of uploading'
required: false
default: false
type: boolean
jobs:
build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -85,8 +94,13 @@ jobs:
run: mv /home/runner/work/wazuh-dashboard/wazuh-dashboard/artifacts/target/opensearch-dashboards-${{ env.VERSION }}-linux-${{ matrix.ARCHITECTURE }}.${{ matrix.DISTRIBUTION }} /home/runner/work/wazuh-dashboard/wazuh-dashboard/artifacts/target/${{ env.ARTIFACT_BUILD_NAME }}

- uses: actions/upload-artifact@v3
if: success()
if: success() && !inputs.CACHE
with:
name: ${{ env.ARTIFACT_BUILD_NAME }}
path: ./artifacts/target/${{ env.ARTIFACT_BUILD_NAME }}
retention-days: 30
- uses: actions/cache@v4
if: success() && inputs.CACHE
with:
path: ./artifacts/target/${{ env.ARTIFACT_BUILD_NAME }}
key: ${{ env.ARTIFACT_BUILD_NAME }}

0 comments on commit 2f843bd

Please sign in to comment.