Skip to content

Commit

Permalink
chore: zip build artifacts (#2258)
Browse files Browse the repository at this point in the history
This change will centrally handle zipping and unzipping of build
artifacts for faster upload/download. There is one catch to this PR: the
download action always runs on the main branch (for security reasons)
and cannot be tested, therefore the documentation publishing workflow
fails for this PR. To actually test it, we'd need to merge this PR and
push a change to the documentation.
gfellerph authored Nov 16, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 3180e06 commit f6d656d
Showing 5 changed files with 14 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .github/actions/artifact-download/action.yaml
Original file line number Diff line number Diff line change
@@ -48,6 +48,10 @@ runs:
run_id: ${{ github.event.workflow_run.id }}
workflow_conclusion: success

- name: Unzip artifacts
shell: bash
run: unzip artifacts.zip

- name: Create outputs
id: build
shell: bash
6 changes: 5 additions & 1 deletion .github/actions/artifact-upload/action.yaml
Original file line number Diff line number Diff line change
@@ -35,8 +35,12 @@ runs:
echo ${{ github.event.number }} > ${{ inputs.folder }}/GHA-EVENT-ID
echo ${{ github.event.action }} > ${{ inputs.folder }}/GHA-EVENT-ACTION
- name: Zip artifact folder
shell: bash
run: zip artifacts.zip ${{ inputs.folder }} -r

- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.name }}
path: ${{ inputs.folder }}
path: artifacts.zip
4 changes: 2 additions & 2 deletions .github/workflows/build-documentation.yaml
Original file line number Diff line number Diff line change
@@ -38,13 +38,13 @@ jobs:
run: pnpm --filter design-system-documentation... build

- name: Upload documentation
uses: swisspost/design-system/.github/actions/artifact-upload@main
uses: ./.github/actions/artifact-upload
with:
name: design-system-documentation
folder: packages/documentation/storybook-static

- name: Upload internet header package
uses: swisspost/design-system/.github/actions/artifact-upload@main
uses: ./.github/actions/artifact-upload
with:
name: internet-header
folder: packages/internet-header/dist
4 changes: 2 additions & 2 deletions .github/workflows/deploy-documentation.yaml
Original file line number Diff line number Diff line change
@@ -25,14 +25,14 @@ jobs:
uses: swisspost/design-system/.github/actions/setup-pnpm@main

- name: Download build artifacts
uses: swisspost/design-system/.github/actions/artifact-download@main
uses: ./.github/actions/artifact-download
id: build
with:
name: design-system-documentation
folder: build-output

- name: Deploy documentation to netlify
uses: swisspost/design-system/.github/actions/deploy-to-netlify@main
uses: ./.github/actions/deploy-to-netlify
id: deploy
with:
id: ${{ steps.build.outputs.id }}
1 change: 1 addition & 0 deletions packages/documentation/src/noop.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
triggering a doc build, nothing to see here

0 comments on commit f6d656d

Please sign in to comment.