Skip to content

Publish

Publish #42

Workflow file for this run

name: Publish
on:
release:
types: [released]
env:
VERSION: ${{ github.event.release.tag_name }}
WEB_PATH: "react-dom/${{ github.event.release.tag_name }}/docs/"
DRY_RUN: false
permissions:
contents: read # Permission for actions/checkout
id-token: write # Permission for aws-actions/configure-aws-credentials
jobs:
publish:
name: Publish
runs-on: [ubuntu-latest]
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20
cache: npm
- name: Install Dependencies
run: npm ci
- name: Apply version to package.json, readme and docs
uses: ./.github/actions/apply-version
with:
version: ${{ env.VERSION }}
## Publish the API docs
- name: Build Storybook
run: npm run build-storybook
- name: Assume AWS role
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: ${{ secrets.AWS_UPLOADER_ROLE_PLAYERS }}
aws-region: us-east-1
- name: Upload to S3
uses: ./.github/actions/upload-to-s3
with:
directory: "./dist/storybook"
destination: "${{ secrets.AWS_WEB_BUCKET }}/${{ env.WEB_PATH }}"
dry-run: ${{ env.DRY_RUN }}
## Publish the NPM package
- name: Build
run: npm run build
- name: Publish to NPM
uses: ./.github/actions/publish
with:
version: ${{ env.VERSION }}
npm-token: ${{ secrets.CLPLAYERS_NPM_TOKEN_REACT_COMPONENTS }}
dry-run: ${{ env.DRY_RUN }}
- name: Add Job summary
run: |
echo '### NPM Release' >> $GITHUB_STEP_SUMMARY
echo "Released version ${{ env.VERSION }} of https://www.npmjs.com/package/@castlabs/prestoplay-react-components" >> $GITHUB_STEP_SUMMARY
echo '### Docs' >> $GITHUB_STEP_SUMMARY
echo "Published docs to https://players.castlabs.com/${{ env.WEB_PATH }}" >> $GITHUB_STEP_SUMMARY