Skip to content

Publish to CDN

Publish to CDN #19

Workflow file for this run

name: Publish to CDN
on:
workflow_dispatch:
inputs:
version:
description: "The release tag to use"
required: true
bucket:
description: "S3 bucket to upload to"
default: "prod-cdn.ably.com"
type: choice
options:
- "prod-cdn.ably.com"
- "nonprod-cdn.ably.com"
role-to-assume:
description: "The AWS role to assume"
default: "prod-ably-sdk-cdn"
type: choice
options:
- "prod-ably-sdk-cdn"
- "nonprod-ably-sdk-cdn"
jobs:
publish:
runs-on: ubuntu-latest
# These permissions are necessary to run the configure-aws-credentials action
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.version }}
- uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::${{ secrets.ABLY_AWS_ACCOUNT_ID_SDK }}:role/${{ github.event.inputs.role-to-assume }}
aws-region: us-east-1
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies and build
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm ci
npm run build
# Note: If you modify what we upload to the CDN, you must make sure you keep the `test:cdn-bundle` NPM script in sync with your changes.
- run: |
aws s3 cp ./dist/iife/index.bundle.js s3://${{ github.event.inputs.bucket }}/spaces/${{ github.event.inputs.version }}/iife/index.bundle.js