Merge pull request #184 from whereby/dependabot/npm_and_yarn/tar-6.2.1 #136
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: Build, test, release | |
on: | |
push: | |
branches: | |
- main | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
build-test-release: | |
name: Build, test, release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
cache: "yarn" | |
cache-dependency-path: | | |
yarn.lock | |
- name: Cache turbo setup | |
uses: actions/cache@v3 | |
with: | |
path: .turbo | |
key: ${{ runner.os }}-turbo-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-turbo- | |
- name: Install Dependencies | |
run: yarn install --frozen-lockfile | |
- name: Run Tests | |
run: yarn test --cache-dir=.turbo | |
- name: Build | |
run: yarn build --cache-dir=.turbo | |
- name: Create Release Pull Request or Publish to npm | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
# This expects you to have a script called release which does a build for your packages and calls changeset publish | |
publish: yarn release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Deploy CDN build - browser-sdk | |
if: steps.changesets.outputs.published == 'true' && contains(fromJSON(steps.changesets.outputs.publishedPackages).*.name, '@whereby.com/browser-sdk') | |
uses: ./.github/actions/deploy-cdn | |
with: | |
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
package: "browser-sdk" | |
dest_dir: "embed" | |
- name: Send Slack message | |
if: steps.changesets.outputs.published == 'true' | |
uses: ./.github/actions/notify-slack | |
with: | |
channel_id: ${{ vars.WHEREBY_DEPLOYMENT_SLACK_CHANNEL_ID }} | |
slack_bot_token: ${{ secrets.WHEREBY_DEPLOYMENT_SLACK_BOT_TOKEN }} | |
published_packages: ${{ steps.changesets.outputs.publishedPackages }} |