CDN release #16
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: "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 18.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "18.x" | |
cache: "yarn" | |
registry-url: https://registry.npmjs.org/ | |
- name: Install shared dependencies | |
run: yarn install --immutable | |
- name: Install package dependencies | |
working-directory: packages/${{ env.PACKAGE_DIR }} | |
run: yarn install --immutable | |
- 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; |