Publish to CDN #16
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 14.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 14.x | |
- name: Install dependencies and build | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
npm ci | |
npm run build | |
- run: | | |
aws s3 cp ./dist/iife/index.bundle.js s3://${{ github.event.inputs.bucket }}/spaces/${{ github.event.inputs.version }}/iife/index.bundle.js | |
publish_legacy: | |
if: ${{ github.event.inputs.bucket == 'prod-cdn.ably.com' }} # Only run for the prod build | |
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_PRODUCTION }}:role/github-actions-sdk | |
aws-region: us-east-1 | |
- name: Use Node.js 14.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 14.x | |
- name: Install dependencies and build | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
npm ci | |
npm run build | |
- run: | | |
aws s3 cp ./dist/iife/index.bundle.js s3://cdn.ably.io/spaces/${{ github.event.inputs.version }}/iife/index.bundle.js |