-
Notifications
You must be signed in to change notification settings - Fork 2
88 lines (72 loc) · 2.63 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Publish
# TODO change this trigger later
on:
pull_request:
branches:
- main
env:
NPM_TOKEN: ${{ secrets.CLPLAYERS_NPM_TOKEN_RW }}
# VERSION: ${{ github.event.release.tag_name }}
VERSION: 0.7.7
jobs:
setup:
name: Setup
runs-on: [ubuntu-latest]
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
cache: npm
- name: Install dependencies
run: npm ci
publish-to-npm:
name: Publish to NPM
runs-on: [ubuntu-latest]
needs: [setup]
steps:
- name: Write NPM RC
run: |
echo '@castlabs:registry=https://registry.npmjs.org' > .npmrc
echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' >> .npmrc
- name: Set Package Version
run: npm --no-git-tag-version --allow-same-version version ${{ env.VERSION }}
- name: Build
run: npm run build
# TODO NOT dry run
- name: Publish to NPM
run: npm publish --dry-run
- name: 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
publish-api-docs:
name: Publish API Docs
runs-on: [ubuntu-latest]
needs: [setup]
steps:
- name: Build Storybook
run: npm run build-storybook
# # TODO remove this debug
# - name: Debug Echo target bucket
# run: echo "s3://players-castlabs-com-root/react-dom/${{ env.VERSION }}/"
# - name: Debug List Dist
# run: ls -la ./dist/storybook
# # TODO how does not work, does the repo need to be registered to be
# # able to assume that role or what?
# - name: Assume AWS role
# uses: aws-actions/configure-aws-credentials@v1-node16
# with:
# role-to-assume: arn:aws:iam::068037490145:role/prestoplay-web-web-uploader
# aws-region: us-east-1
# Is there a dry run? Let's perhaps try version 0.0.1
# - name: Upload to S3
# run: aws s3 cp --recursive “./dist/storybook "s3://players-castlabs-com-root/react-dom/${{ env.VERSION }}/"
# Let’s keep the default cache policy which is 1 day
# This will publish to https://players.castlabs.com/react-dom (I hope)
# - name: 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