Skip to content

Commit

Permalink
CI: Add variables to artifact names (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mintoo200 authored Mar 19, 2024
2 parents 9779561 + 9601e0f commit e664d1f
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 5 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: "CI"

on: [push]
on: [pull_request]

jobs:
tests:
Expand All @@ -10,6 +10,10 @@ jobs:
build:
needs: [tests, type-check]
uses: ./.github/workflows/build.yml
with:
artifact-name: "lib-${{ github.head_ref }}"
build-storybook:
needs: [tests, type-check]
uses: ./.github/workflows/build-storybook.yml
with:
artifact-name: "storybook-${{ github.head_ref }}"
20 changes: 18 additions & 2 deletions .github/workflows/build-storybook.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
name: 'Build Storybook'

on: [workflow_call, workflow_dispatch]
on:
workflow_call:
inputs:
artifact-name:
description: name of the artifact to be pushed
required: true
type: string
workflow_dispatch:
inputs:
artifact-name:
description: name of the artifact to be pushed
required: false
type: string

env:
ARTIFACT_NAME: ${{ inputs.artifact-name || format('storybook-{0}', github.sha) }}

jobs:
build:
Expand All @@ -21,6 +36,7 @@ jobs:
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: storybook-${{ github.sha }}
# TODO (GAFI 19-03-2024): Add variable for this to avoid using ref when not provided
name: ${{ env.ARTIFACT_NAME }}
path: ./storybook-static
if-no-files-found: error
20 changes: 18 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
name: 'Build'

on: [workflow_call, workflow_dispatch]
on:
workflow_call:
inputs:
artifact-name:
description: name of the artifact to be pushed
required: true
type: string
workflow_dispatch:
inputs:
artifact-name:
description: name of the artifact to be pushed
required: false
type: string

env:
ARTIFACT_NAME: ${{ inputs.artifact-name || format('lib-{0}', github.sha) }}

jobs:
build:
Expand All @@ -21,6 +36,7 @@ jobs:
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: lib-${{ github.sha }}
# TODO (GAFI 19-03-2024): Add variable for this to avoid using ref when not provided
name: ${{ env.ARTIFACT_NAME }}
path: ./dist
if-no-files-found: error

0 comments on commit e664d1f

Please sign in to comment.