Skip to content

Test script

Test script #3

Workflow file for this run

# ---
# name: Build, test & deploy
# on:
# release:
# types: [created]
# jobs:
# build_and_test:
# concurrency: build_and_test_main_${{ github.head_ref }}
# name: Build & test
# runs-on: ubuntu-latest
# env:
# GITHUB_TOKEN: ${{ secrets.WHEREBY_GITHUB_TOKEN }}
# steps:
# - name: Checkout source code
# uses: actions/checkout@v3
# - name: Build
# uses: ./.github/actions/build
# - name: Test
# run: yarn test
# get_version_tag:
# runs-on: ubuntu-latest
# needs: build_and_test
# outputs:
# tag: ${{ steps.tag_check.outputs.tag }}
# steps:
# - uses: actions/checkout@v3
# - name: Get version tag
# id: tag_check
# # 1st sed: remove major.minor.patch numbers
# # 2nd sed: remove wrapper quotes
# # 3rd sed: remove "-" and tag version if exists
# run: |
# TAG=$(npm pkg get version \
# | sed 's/\([0-9]*\.[0-9]*\.[0-9]*\)//' \
# | sed 's/^"\(.*\)"$/\1/' \
# | sed 's/-\([a-z]*\)\([0-9]*\)/\1/')
# echo "tag=$TAG" >> $GITHUB_OUTPUT
# deploy_cdn:
# concurrency: deploy_cdn_main_${{ github.head_ref }}
# name: Deploy to CDN
# needs: get_version_tag
# # Only run when there's no version tag (e.g. -beta) specified
# if: ${{ needs.get_version_tag.outputs.tag == 0 }}
# runs-on: ubuntu-latest
# env:
# GITHUB_TOKEN: ${{ secrets.WHEREBY_GITHUB_TOKEN }}
# steps:
# - name: Checkout source code
# uses: actions/checkout@v3
# - name: Build
# uses: ./.github/actions/build
# - name: Configure AWS Credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# aws-region: eu-west-1
# - uses: jakejarvis/s3-sync-action@v0.5.1
# with:
# args: --acl public-read --follow-symlinks
# env:
# AWS_S3_BUCKET: whereby-cdn
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# AWS_REGION: "es-west-1"
# SOURCE_DIR: "dist/cdn/"
# DEST_DIR: "embed/"
# - name: Invalidate cloudfront publication
# run: aws cloudfront create-invalidation --distribution-id=E6H48QPJYYL39 --paths "/embed/*"
# deploy_npm:
# concurrency: deploy_npm_main_${{ github.head_ref }}
# name: Deploy to npm
# needs: get_version_tag
# runs-on: ubuntu-latest
# steps:
# - name: Checkout source code
# uses: actions/checkout@v3
# # Setup .npmrc file to publish to npm
# - uses: actions/setup-node@v3
# with:
# node-version: "20.x"
# registry-url: "https://registry.npmjs.org"
# - name: Build
# uses: ./.github/actions/build
# - name: Publish on npm
# run: |
# TAG=${{ needs.get_version_tag.outputs.tag }}
# if [[ -z ${TAG} ]]; then
# echo "deploy with latest tag"
# npm publish
# else
# echo "deploy with ${{ needs.get_version_tag.outputs.tag }} tag"
# npm publish --tag ${{ needs.get_version_tag.outputs.tag }}
# fi
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}