-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (117 loc) · 3.83 KB
/
Copy pathdeploy_js.yml
File metadata and controls
131 lines (117 loc) · 3.83 KB
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Deploy schematic-js
permissions:
id-token: write
contents: read
on:
push:
tags:
- "schematic-js@*"
workflow_dispatch:
jobs:
lint:
name: Lint
runs-on: runs-on=${{ github.run_id }}/runner=4cpu-linux-x64/extras=s3-cache
steps:
- uses: runs-on/action@v2.0.3
- uses: actions/checkout@v5.0.0
- uses: actions/setup-node@v6
with:
node-version: 24.x
- name: Yarn install
working-directory: ./js
run: yarn install
- name: Lint
working-directory: ./js
run: yarn lint
test:
name: Test
runs-on: runs-on=${{ github.run_id }}/runner=4cpu-linux-x64/extras=s3-cache
steps:
- uses: runs-on/action@v2.0.3
- uses: actions/checkout@v5.0.0
- uses: actions/setup-node@v6
with:
node-version: 24.x
- name: Yarn install
working-directory: ./js
run: yarn install
- name: Test
working-directory: ./js
run: yarn test
- name: Test (React Native)
working-directory: ./js
run: yarn test:reactnative
deploy:
name: Browser Deploy
runs-on: runs-on=${{ github.run_id }}/runner=4cpu-linux-x64/extras=s3-cache
needs: ["test", "lint"]
steps:
- uses: runs-on/action@v2.0.3
- uses: actions/checkout@v5.0.0
- name: Set Node.js 24.x
uses: actions/setup-node@v6
with:
node-version: 24.x
- name: Yarn install
working-directory: ./js
run: yarn install
- name: Update version
working-directory: ./js
run: ./version.sh
- name: Build browser bundle
working-directory: ./js
run: yarn build:browser
- name: 🚀auth-oidc-aws-prod
uses: aws-actions/configure-aws-credentials@v5.1.0
with:
role-to-assume: ${{ vars.PROD_AWS_ROLE_ARN }}
aws-region: ${{ vars.PROD_AWS_REGION }}
- name: Get package version
id: package
run: |
echo "version=$(node -p "require('./package.json').version")" >> "$GITHUB_OUTPUT"
working-directory: ./js
- name: Deploy browser build
run: |
aws s3 cp dist/schematic.browser.js s3://${{ vars.PROD_JS_BUCKET_NAME }}/js/schematic.js
aws s3 cp dist/schematic.browser.js s3://${{ vars.PROD_JS_BUCKET_NAME }}/js/schematic.${{ steps.package.outputs.version }}.js
aws configure set preview.cloudfront true
aws cloudfront create-invalidation --distribution-id ${{ vars.PROD_JS_DISTRIBUTION_ID }} --paths "/js/schematic.js" "/js/schematic.${{ steps.package.outputs.version }}.js"
working-directory: ./js
publish:
name: NPM Publish
runs-on: runs-on=${{ github.run_id }}/runner=4cpu-linux-x64/extras=s3-cache
permissions:
packages: write
contents: read
needs: ["test", "lint"]
steps:
- uses: runs-on/action@v2.0.3
- uses: actions/checkout@v5.0.0
- name: Set Node.js 24.x
uses: actions/setup-node@v6
with:
node-version: 24.x
- name: Yarn install
working-directory: ./js
run: yarn install
- name: Build
working-directory: ./js
run: yarn build
- name: Set up .npmrc
run: touch .npmrc && echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
working-directory: ./js
- run: yarn publish --access public
working-directory: ./js
notify_slack:
name: Notify Slack
runs-on: runs-on=${{ github.run_id }}/runner=1cpu-linux-arm64
needs: [deploy, publish]
steps:
- uses: rtCamp/action-slack-notify@v2.3.3
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_TITLE: Updated schematic-js
SLACK_ICON: https://schematic-public-assets.s3.amazonaws.com/logos/logo-transparent.png