Skip to content

fix(vite): fallback for CommonJS #439

fix(vite): fallback for CommonJS

fix(vite): fallback for CommonJS #439

Workflow file for this run

name: CD
on:
push:
branches:
- master
- 'release-*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Cache node_modules
id: cache-modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('package.json') }}
- name: Install 🔧 # Installs dependencies
run: yarn install --immutable
- name: Build
run: yarn build
publish:
if: ${{ !contains(github.event.head_commit.message, '[skip-ci]') &&
(
(github.ref == 'refs/heads/master' && contains(github.event.head_commit.message, '[release]')) ||
(startsWith(github.ref, 'refs/heads/release-') &&
(startsWith(github.event.head_commit.message, 'fix:') ||
startsWith(github.event.head_commit.message, 'fix(') ||
startsWith(github.event.head_commit.message, 'feat:') ||
startsWith(github.event.head_commit.message, 'feat(') ||
contains(github.event.head_commit.message, '[release]')
)
)
)
}}
runs-on: ubuntu-latest
environment: CD
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Cache node_modules
id: cache-modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('package.json') }}
- name: Install 🔧 # Installs dependencies
run: yarn install --immutable
- name: Lerna env config
run: |
git config --global user.email "[email protected]"
git config --global user.name "Cognite CICD"
git remote set-url origin "https://${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" > /dev/null 2>&1
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc
env:
NPM_TOKEN: ${{secrets.NPM_PUBLISH_TOKEN}}
GITHUB_TOKEN: ${{secrets.GH_LERNA_TOKEN}} # Temporary fix to make lerna able to push the new versions commit to master
- name: Build
run: yarn build
- name: Build doc
run: yarn docs:bundle
# Remove rc tag in master branch when it is a [release] commit
- name: Remove RC tags
if: ${{ github.ref == 'refs/heads/master' && contains(github.event.head_commit.message, 'Merge pull request') && contains(github.event.head_commit.message, 'release-') && contains(github.event.head_commit.message, '[release]') }}
run: |
node scripts/remove-rc-tags.js
git config --global user.email "[email protected]"
git config --global user.name "Cognite CICD"
git add packages/*/package.json
git commit -m "chore: remove rc tags [skip-ci]"
git push origin master
- name: Lerna version
env:
GH_TOKEN: ${{ secrets.GH_LERNA_TOKEN }} # Temporary fix to make lerna able to push the new versions commit to master
GITHUB_TOKEN: ${{ secrets.GH_LERNA_TOKEN }} # Temporary fix to make lerna able to push the new versions commit to master
run: |
if [[ "${GITHUB_REF}" == "refs/heads/master" ]]; then
EVENT_PATH_CONTENT=$(cat ${GITHUB_EVENT_PATH} | jq -r '.')
HEAD_COMMIT_MSG=$(echo $EVENT_PATH_CONTENT | jq -r '.head_commit.message')
MERGE_COMMIT_MSG=$(echo $EVENT_PATH_CONTENT | jq -r '.commits[-1].message')
if [[ "$HEAD_COMMIT_MSG" == *"Merge"* && "$HEAD_COMMIT_MSG" == *"release-"* && "$HEAD_COMMIT_MSG" == *"[release]"* ]] ||
[[ "$MERGE_COMMIT_MSG" == *"Merge"* && "$MERGE_COMMIT_MSG" == *"release-"* && "$MERGE_COMMIT_MSG" == *"[release]"* ]]; then
echo "Running major version bump for release merge"
yarn lerna version major --conventional-commits --create-release github --no-private --yes --force-publish
else
echo "Running conventional commit versioning on master"
yarn lerna version --conventional-commits --create-release github --no-private --yes
fi
elif [[ "${GITHUB_REF}" == refs/heads/release-* ]]; then
echo "Running pre-release versioning on release branch"
yarn lerna version --conventional-commits --conventional-prerelease --preid rc --create-release github --no-private --yes
fi
- name: Lerna Publish
if: contains(github.event.head_commit.message, '[release]')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
run: |
if [[ "${GITHUB_REF}" == "refs/heads/master" ]]; then
yarn lerna publish from-package --yes --no-git-reset --no-verify-access
elif [[ "${GITHUB_REF}" == refs/heads/release-* ]]; then
yarn lerna publish from-package --pre-dist-tag rc --yes --no-git-reset --no-verify-access
fi
# - name: Publish documentation
# uses: JamesIves/github-pages-deploy-action@releases/v3
# with:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# BRANCH: gh-pages # The branch the action should deploy to.
# FOLDER: docs