From 8eb17edfc547d0a2bcae3bee6c5e6d6ab5fbbb64 Mon Sep 17 00:00:00 2001 From: Gauthier Fiorentino Date: Tue, 19 Mar 2024 16:51:31 +0100 Subject: [PATCH 1/4] CI: Rename artifact to contain source branch instead of sha --- .github/workflows/CI.yml | 2 +- .github/workflows/build-storybook.yml | 3 ++- .github/workflows/build.yml | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 8b4897f..6f759c7 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,6 +1,6 @@ name: "CI" -on: [push] +on: [pull_request] jobs: tests: diff --git a/.github/workflows/build-storybook.yml b/.github/workflows/build-storybook.yml index 32ed0c9..d95ddbd 100644 --- a/.github/workflows/build-storybook.yml +++ b/.github/workflows/build-storybook.yml @@ -21,6 +21,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: storybook-${{ github.head_ref }} path: ./storybook-static if-no-files-found: error diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5ac2e60..a13fbdf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,6 +21,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: lib-${{ github.head_ref }} path: ./dist if-no-files-found: error From d4fe780058477c20efbefd5c41b249fc4120e5e2 Mon Sep 17 00:00:00 2001 From: Gauthier Fiorentino Date: Tue, 19 Mar 2024 17:00:22 +0100 Subject: [PATCH 2/4] CI: Add environement variable to storybook build --- .github/workflows/build-storybook.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-storybook.yml b/.github/workflows/build-storybook.yml index d95ddbd..ac4f48b 100644 --- a/.github/workflows/build-storybook.yml +++ b/.github/workflows/build-storybook.yml @@ -2,6 +2,9 @@ name: 'Build Storybook' on: [workflow_call, workflow_dispatch] +env: + ARTIFACT_NAME: "storybook-${{ github.head_ref }}" + jobs: build: runs-on: ubuntu-latest @@ -22,6 +25,6 @@ jobs: uses: actions/upload-artifact@v4 with: # TODO (GAFI 19-03-2024): Add variable for this to avoid using ref when not provided - name: storybook-${{ github.head_ref }} + name: ${{ env.ARTIFACT_NAME }} path: ./storybook-static if-no-files-found: error From 642e6c47ce08728c49bec8d2138d50d554e2133a Mon Sep 17 00:00:00 2001 From: Gauthier Fiorentino Date: Tue, 19 Mar 2024 17:04:22 +0100 Subject: [PATCH 3/4] CI: Moves naming from build workflow to CI workflow --- .github/workflows/CI.yml | 2 ++ .github/workflows/build-storybook.yml | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 6f759c7..b445cd3 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -13,3 +13,5 @@ jobs: build-storybook: needs: [tests, type-check] uses: ./.github/workflows/build-storybook.yml + with: + artifact-name: "storybook-${{ github.head_ref }}" diff --git a/.github/workflows/build-storybook.yml b/.github/workflows/build-storybook.yml index ac4f48b..6557086 100644 --- a/.github/workflows/build-storybook.yml +++ b/.github/workflows/build-storybook.yml @@ -1,9 +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: "storybook-${{ github.head_ref }}" + ARTIFACT_NAME: ${{ inputs.artifact-name || format('storybook-{0}', github.sha) }} jobs: build: From 9601e0f93f5004c5550e4722eb88c24ddeac57b9 Mon Sep 17 00:00:00 2001 From: Gauthier Fiorentino Date: Tue, 19 Mar 2024 17:38:23 +0100 Subject: [PATCH 4/4] CI: Adds variable to build workflow --- .github/workflows/CI.yml | 2 ++ .github/workflows/build.yml | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index b445cd3..aaeb8a2 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -10,6 +10,8 @@ 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 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a13fbdf..2997a10 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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: @@ -22,6 +37,6 @@ jobs: uses: actions/upload-artifact@v4 with: # TODO (GAFI 19-03-2024): Add variable for this to avoid using ref when not provided - name: lib-${{ github.head_ref }} + name: ${{ env.ARTIFACT_NAME }} path: ./dist if-no-files-found: error