chore: get environment name from variable (#189) #30
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy HTML Storybook to AWS S3 | |
on: | |
push: | |
branches: | |
- main | |
env: | |
AWS_S3_BUCKET_NAME: storybook-html-design-system-blocks-gov-ie | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20.x" | |
- name: Storybook build | |
run: | | |
corepack enable | |
pnpm install --frozen-lockfile --ignore-scripts | |
pnpm html:storybook:build | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3.1.2 | |
with: | |
name: build-artifact | |
path: packages/html/storybook/storybook-static | |
deploy: | |
name: Deploy to Amazon S3 | |
runs-on: ubuntu-latest | |
needs: build | |
permissions: | |
id-token: write | |
contents: read | |
environment: prod | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Download artifact | |
uses: actions/download-artifact@v3.0.2 | |
with: | |
name: build-artifact | |
path: build | |
- name: Setup AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.DS_AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.DS_AWS_SECRET_ACCESS_KEY }} | |
aws-region: eu-west-1 | |
- name: Deploy to S3 | |
run: aws s3 sync build/ s3://$AWS_S3_BUCKET_NAME/ |