Merge pull request #95 from yourssu/develop #10
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: build and deploy storybook to s3, publish to npm | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Set up pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build | |
run: pnpm build | |
- name: Build storybook | |
run: pnpm build-storybook --output-dir=storybook-static | |
- name: Extract version from package.json | |
id: version | |
run: echo ::set-output name=VERSION::$(node -p "require('./package.json').version") | |
- name: Deploy to s3 | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
run: | | |
aws s3 cp \ | |
--recursive \ | |
--region ap-northeast-2 \ | |
./storybook-static \ | |
s3://yds-react-storybook/${{ steps.version.outputs.VERSION }} | |
- name: Publish to NPM | |
run: npm publish | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |