Publish #38
Workflow file for this run
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: Publish | |
# Test new NPM TOKEN and provenance (1 beta release) | |
# Test that `publish` still works (beta/non beta on dry run) | |
on: | |
release: | |
types: [released] | |
env: | |
VERSION: ${{ github.event.release.tag_name }} | |
WEB_PATH: "react-dom/${{ github.event.release.tag_name }}/docs/" | |
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 | |
run: aws s3 cp --recursive --dryrun "./dist/storybook" "${{ secrets.AWS_WEB_BUCKET }}/${{ env.WEB_PATH }}" | |
# Note: the default cache policy is 1 day, I think that's OK for now. | |
# In the future if traffic increases we can increase the expiration | |
# as much as we want. | |
## Publish the NPM package | |
- name: Build | |
run: npm run build | |
- name: Publish to NPM | |
uses: ./.github/actions/publish | |
with: | |
version: ${{ env.VERSION }} | |
# TODO change | |
npm-token: ${{ secrets.CLPLAYERS_NPM_TOKEN_RW }} | |
dry-run: true | |
- 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 |