8000 Add GitHub Action to Detect TypeScript Version Conflicts by siyuniu-ms · Pull Request #128 · microsoft/applicationinsights-react-js · GitHub
[go: up one dir, main page]

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/npm-grunt.yml
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 }}

Loading
0