Skip to content

CDN release

CDN release #10

name: "CDN release"
on:
workflow_dispatch:
inputs:
package:
description: "Package for CDN release"
required: true
default: "webrtc"
env:
PACKAGE_DIR: ${{ github.event.inputs.package == 'webrtc' && 'js' || github.event.inputs.package }}
jobs:
build:
if: contains(fromJson('["webrtc"]'), github.event.inputs.package)
name: "@telnyx/${{ github.event.inputs.package }} CDN release"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
# https://github.com/peter-evans/create-pull-request/issues/122
ref: "main"
# https://github.com/release-it/release-it/issues/657#issuecomment-647848200
fetch-depth: 0
- name: Setup Git user
# https://github.com/actions/checkout/issues/13
run: |
git config user.name TelnyxIntegrations
git config user.email [email protected]
- name: Use Node.js 16.x
uses: actions/setup-node@v4
with:
node-version: "16.x"
cache: "yarn"
registry-url: https://registry.npmjs.org/
- name: Install shared dependencies
run: yarn install --frozen-lockfile
- name: Install package dependencies
working-directory: packages/${{ env.PACKAGE_DIR }}
run: yarn install --frozen-lockfile
- name: Test
working-directory: packages/${{ env.PACKAGE_DIR }}
run: yarn test
- name: Build compiled JS files
working-directory: packages/${{ env.PACKAGE_DIR }}
run: yarn build
env:
CI: true
NPM_TOKEN: ${{ secrets.NPM_CI_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up S3cmd cli tool
uses: s3-actions/[email protected]
with:
provider: aws
region: "us-east-1"
access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Deploy files to downloads/webrtc folder
run: |
s3cmd sync ./packages/js/lib/bundle.js s3://portal.telnyx.com/downloads/webrtc/ \
--exclude="downloads/*" \
--add-header='Cache-Control: public, must-revalidate' \
--acl-public \
--no-preserve \
--delete-removed \
--delete-after \
--cf-invalidate-default-index \
--recursive;
s3cmd modify s3://portal.telnyx.com/downloads/webrtc/*.js \
--mime-type='text/javascript' \
--cf-invalidate;