-
Notifications
You must be signed in to change notification settings - Fork 22
92 lines (77 loc) · 2.8 KB
/
publish-beta-package.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
89
90
91
name: New Pull request; publish as beta package
on:
pull_request:
branches: [ "master" ]
env:
NPM_REGISTRY_URL: "https://registry.npmjs.com"
BETA_SUFFIX: 'beta.0'
CDN_AWS_PUBLISH_ROLE: arn:aws:iam::654344198836:role/github-actions-oidc-role-nonprod-sign-embedded
CDN_BUCKET: cdn.staging-hellosign.com
CDN_PATH: public/js/embedded
AWS_REGION: us-east-1
jobs:
build:
permissions:
id-token: write # This is required for requesting the JWT
contents: write # This is required for publishing releases
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x] # we should pull this from a common place
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
registry-url: ${{ env.NPM_REGISTRY_URL }}
- name: Build
run: |
npm install
npm run build
- name: Test
run: |
npm test
- name: Validate Semver
id: version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: .github/actions-scripts/validate-release-version.js --beta
- name: Set Beta Version
env:
PACKAGE_VERSION: ${{ steps.version.outputs.version }}
run: |
echo "Setting beta version ${PACKAGE_VERSION}"
npm version ${PACKAGE_VERSION} --no-git-tag-version
- name: Pack
run: |
npm pack --pack-destination="./umd"
- name: Create tag
uses: actions/github-script@v5
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ steps.version.outputs.version }}',
tag_name: 'v${{ steps.version.outputs.version }}',
name: 'v${{ steps.version.outputs.version }}',
draft: true,
prerelease: true,
sha: context.sha
})
- name: Publish Beta
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm publish --tag beta --provenance --access=public
- name: Configure AWS credentials for Non-Prod
id: awskeys
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.CDN_AWS_PUBLISH_ROLE }}
aws-region: ${{ env.AWS_REGION }}
- name: Copy dev build to nonprod cdn
run: aws s3 cp umd/embedded.development.js s3://${{ env.CDN_BUCKET }}/${{ env.CDN_PATH }}/v${{ steps.version.outputs.value }}/
- name: Copy minified build to nonprod cdn
run: aws s3 cp umd/embedded.production.min.js s3://${{ env.CDN_BUCKET }}/${{ env.CDN_PATH }}/v${{ steps.version.outputs.value }}/