[Pre-Release] Update Application Insights dependencies to v3.3.6 (#144) #23
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: NodeJS with Grunt | |
on: | |
push: | |
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 }} | |