Skip to content

Storybook Deploy

Storybook Deploy #243

name: Storybook Deploy
on:
workflow_dispatch:
permissions:
id-token: write
contents: read
jobs:
Deploy:
runs-on: [self-hosted, x64, linux, eks, us, demand, dev]
outputs:
branch_name: ${{ steps.branch_name.outputs.branch }}
folder_name: ${{ steps.branch_name.outputs.folder }}
steps:
- uses: actions/checkout@v3
- name: Setup Node.js Enviroment 🛠️
uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'npm'
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y vim jq
- name: Cache node deps
id: cache-deps
uses: actions/cache@v3
with:
path: ./node_modules
key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}
- name: Install Dependencies 📦
if: steps.cache-deps.outputs.cache-hit != 'true'
run: npm ci
- name: Extract branch name
shell: bash
run: |
echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT
echo "folder=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_OUTPUT
id: branch_name
- name: Test Output
run: |
echo "Folder: ${{ steps.branch_name.outputs.folder }}"
- name: Build storybook static
run: npm run build-storybook
- name: Install AWS cli
run: |
if ! [ -x "$(command -v aws)" ]; then
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.0.30.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
fi
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-region: us-east-1
role-to-assume: arn:aws:iam::032106861074:role/github-runners-demand-team-role
- name: Deploy to s3 bucket
run: '${GITHUB_WORKSPACE}/.github/actions/deploy-storybook.sh ${{ steps.branch_name.outputs.folder }} '
notify-success:
needs: Deploy
if: ${{ always() && needs.Deploy.result == 'success'}}
runs-on: [self-hosted, x64, linux, eks, us, demand, dev]
steps:
- name: 'Deploy success notify'
uses: ironSource/action-slack-notification@v1
with:
channel: fusion-docs-notifications
username: FusionUI-CI
icon_url: "https://avatars.githubusercontent.com/t/5433436?s=32&v=4"
message: "<!channel> Storybook on branch *${{ needs.Deploy.outputs.branch_name }}* by *${{github.actor}}* published success.\n You can check it on: https://fusion-storybook.ironsrc.mobi/branch_${{ needs.Deploy.outputs.folder_name }}/"
slack_webhook: ${{ secrets.SLACK_PATH }}