Skip to content

[DW-3497] Add descriptor and global header #201

[DW-3497] Add descriptor and global header

[DW-3497] Add descriptor and global header #201

name: Distribution Workflow
on:
push:
tags:
- v*
jobs:
#
# Build homepage distribution from source
#
build_homepage:
name: "Build Homepage Distribution"
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
#
# Step 1
# Checkout the project's sourcecode
#
- name: Checkout
uses: actions/checkout@v3
#
# Step 2
# Set Node.js version
#
- name: Request Node Version
uses: actions/setup-node@v3
with:
node-version: '16.19.0'
cache: 'npm'
#
# Step 3
#
- name: Initialise NPM
run: npm i
working-directory: homepage
#
# Step 4
#
- name: Build dist folder
run: npm run build
working-directory: homepage
#
# Step 5
# Store homepage distribution workflow artifacts
#
- name: Archive dist artifacts
uses: actions/upload-artifact@v3
with:
name: homepage-dist
path: homepage/dist/
#
# Build CDN Distribution from source
#
build_dist:
name: "Build CDN Distribution"
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
#
# Step 1
# Checkout the project's sourcecode
#
- name: Checkout
uses: actions/checkout@v3
#
# Step 2
# Set Node.js version
#
- name: Request Node Version
uses: actions/setup-node@v3
with:
node-version: '16.19.0'
cache: 'npm'
#
# Step 3
#
- name: Initialise NPM
run: npm i
#
# Step 4
#
- name: Build dist folder
run: npm run dist:build:prod
#
# Step 5
# Store CDN distribution workflow artifacts
#
- name: Archive dist artifacts
uses: actions/upload-artifact@v3
with:
name: cdn-dist
path: |
dist/fonts/
dist/icons/
dist/images/
dist/scripts/
dist/static/
dist/stylesheets/
#
# Build Storybook from source
#
build_storybook:
name: "Build Storybook Distribution"
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
#
# Step 1
# Checkout the project's sourcecode
#
- name: Checkout
uses: actions/checkout@v3
#
# Step 2
# Set Node.js version
#
- name: Request Node Version
uses: actions/setup-node@v3
with:
node-version: '16.19.0'
cache: 'npm'
#
# Step 3
#
- name: Initialise NPM
run: npm i
#
# Step 4
# Build storybook project
#
- name: Build Storybook
env:
STORYBOOK_VERSION: ${{ github.ref_name }}
run: npm run storybook:build
#
# Step 5
# Store Storybook workflow artifacts
#
- name: Archive storybook artifact
uses: actions/upload-artifact@v3
with:
name: storybook-dist
path: storybook-static/
#
# Build NPM Package from source
#
build_npm_package:
name: "Build NPM Distribution"
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
#
# Step 1
# Checkout the project's sourcecode
#
- name: Checkout
uses: actions/checkout@v3
#
# Step 2
# Set Node.js version
#
- name: Request Node Version
uses: actions/setup-node@v3
with:
node-version: '16.19.0'
cache: 'npm'
#
# Step 3
#
- name: Initialise NPM
run: npm i
#
# Step 4
#
- name: Build NPM
run: npm run package:build:prod
#
# Step 5
# Store NPM Package workflow artifacts
#
- name: Archive NPM package artifact
uses: actions/upload-artifact@v3
with:
name: npm-dist
path: |
package/
#
# Put CDN distribution artifact onto the S3 origin.
#
dist_cdn:
name: "Distribute CDN"
needs:
- build_dist
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
#
# Step 1
# Download CDN artifact and merge version artifact into the same folder
#
- name: Download CDN artifacts
uses: actions/download-artifact@v3
id: download
with:
name: cdn-dist
path: cdn-dist
#
# Step 2
# Set up AWS CLI
#
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.PIPELINE_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.PIPELINE_AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-2
#
# Step 3
# Create versioned release in S3
#
- name: Create version
working-directory: ${{steps.download.outputs.download-path}}
run: aws s3 cp . s3://${{ secrets.S3_ORIGIN }}/cdn/${{ github.ref_name }} --recursive
#
# Put the Storybook distribution artifact onto the S3 origin.
#
dist_storybook:
name: "Distribute Storybook"
needs:
- build_storybook
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
#
# Step 1
# Download CDN artifact and merge version artifact into the same folder
#
- name: Download all workflow artifacts
uses: actions/download-artifact@v3
id: download
with:
name: storybook-dist
path: storybook-dist
#
# Step 2
# Set up AWS CLI
#
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.PIPELINE_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.PIPELINE_AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-2
#
# Step 3
# Create versioned release in S3
#
- name: Create version
working-directory: ${{steps.download.outputs.download-path}}
run: aws s3 cp . s3://${{ secrets.S3_ORIGIN }}/storybook/${{ github.ref_name }} --recursive