-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GitHub Action to Detect TypeScript Version Conflicts (#128)
- Loading branch information
1 parent
4a28a75
commit 0174b99
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: NodeJS with Grunt | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [16.x, 18.x, 20.x, 22.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Update dependencies in package.json | ||
run: | | ||
current_version=$(jq -r '.version' package.json) | ||
echo "Current version: $current_version" | ||
# Extract the part of the version after the first dot | ||
remaining_version=${current_version#*.} | ||
# Concatenate "3." with the remaining part | ||
ai_version="3.$remaining_version" | ||
echo "AI version: $ai_version" | ||
# Replace the versions in sample/applicationinsights-react-sample/package.json with the current reactJS version | ||
sed -i "s/\"@microsoft\\/applicationinsights-core-js\": \"[^\"]*\"/\"@microsoft\/applicationinsights-core-js\": \"$ai_version\"/" sample/applicationinsights-react-sample/package.json | ||
sed -i "s/\"@microsoft\\/applicationinsights-react-js\": \"[^\"]*\"/\"@microsoft\/applicationinsights-react-js\": \"$current_version\"/" sample/applicationinsights-react-sample/package.json | ||
sed -i "s/\"@microsoft\\/applicationinsights-web\": \"[^\"]*\"/\"@microsoft\/applicationinsights-web\": \"$ai_version\"/" sample/applicationinsights-react-sample/package.json | ||
# add applicationinsights-common into package.json also | ||
echo "\"@microsoft/applicationinsights-common\": \"$current_version\"," | sed -i "/\"@microsoft\/applicationinsights-core-js\": \"$ai_version\"/i \ \"@microsoft/applicationinsights-common\": \"$ai_version\"," sample/applicationinsights-react-sample/package.json | ||
- name: Display updated package.json | ||
run: cat sample/applicationinsights-react-sample/package.json | ||
|
||
- name: Get latest version of @microsoft/applicationinsights-web | ||
id: get_version | ||
run: | | ||
latest_version=$(npm show @microsoft/applicationinsights-web version) | ||
echo "Latest version: $latest_version" | ||
echo "latest_version=$latest_version" >> $GITHUB_ENV | ||
- name: Build | ||
working-directory: sample/applicationinsights-react-sample | ||
run: | | ||
npm install | ||
npm install @microsoft/applicationinsights-web@${{ env.latest_version }} --verbose | ||
npm run build | ||
env: | ||
latest_version: ${{ env.latest_version }} | ||
|