Skip to content

SPDE-130: Re-CD this repo #104

SPDE-130: Re-CD this repo

SPDE-130: Re-CD this repo #104

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' # https://kevinkreuzer.medium.com/publishing-a-beta-or-alpha-version-to-npm-46035b630dd7
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 "v${PACKAGE_VERSION} is the proposed new version."
npm version ${PACKAGE_VERSION} --no-git-tag-version
tail -f /home/runner/.npm/_logs/*.log
- name: Pack
run: |
npm pack --pack-destination="./umd"
- name: Publish Beta
run: |
npm publish --tag beta --access=public --dry-run
- 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 }}/