-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: support simpleauth cd on GitHub action (#1954)
* chore: support simpleauth cd on github action * chore: update * chore: update * chore: chrome dirver update * chore: restore simpleauth setting config * chore: update * chore: udpate
- Loading branch information
1 parent
f324d40
commit 8f74bb7
Showing
14 changed files
with
321 additions
and
31 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,18 @@ | ||
#!/bin/bash | ||
if [[ $1 == 'templates' ]]; then | ||
if [[ $SkipSyncup == *"template"* ]]; then | ||
echo "skip sync up templates version with sdk version" | ||
elif [[ -z "$(git tag --points-at HEAD | grep templates)" && ! -z "$(git diff HEAD^ -- ../../templates/package.json|grep version)" ]] | ||
then | ||
echo "need to tag on templates cause templates has no tags but bump up version" | ||
git tag "templates@$(node -p "require('../../templates/package.json').version")" | ||
fi | ||
elif [[ $1 == 'fx-core' ]]; then | ||
if [[ $SkipSyncup == *"fx-core"* ]]; then | ||
echo "skip sync up fx-core version with simpleauth version" | ||
elif [[ -z "$(git tag --points-at HEAD | grep @microsoft/teamsfx-core)" && ! -z "$(git diff HEAD^ -- ../fx-core/package.json|grep version)" ]] | ||
then | ||
echo "need to tag on fx-core cause fx-core has no tags but bump up version" | ||
git tag "@microsoft/teamsfx-core@$(node -p "require('../fx-core/package.json').version")" | ||
fi | ||
fi |
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,22 @@ | ||
#!/bin/bash | ||
if [ $1 == 'templates' ]; then | ||
if [[ $SkipSyncup == *"template"* ]]; then | ||
echo "skip sync up templates version with sdk version" | ||
elif [[ -z "$(git diff -- ../../templates)" ]]; then | ||
echo "need bump up templates version since templates don not bump up by self" | ||
node ../../.github/scripts/sdk-sync-up-version.js yes; | ||
else | ||
echo "no need to bump up templates version" | ||
node ../../.github/scripts/sdk-sync-up-version.js | ||
fi | ||
git add ../../templates | ||
elif [ $1 == 'fx-core' ]; then | ||
if [[ -z "$(git diff -- ../fx-core)" ]]; then | ||
echo "need bump up fx-core version since fx-core don not bump up by self" | ||
node ../../.github/scripts/update-simpleauth-ver.js yes; | ||
else | ||
echo "no need to bump up templates version" | ||
node ../../.github/scripts/update-simpleauth-ver.js | ||
fi | ||
git add ../fx-core | ||
fi |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,26 @@ | ||
#!/bin/bash | ||
countNum=1 | ||
restUrl="https://dev.azure.com/mseng/VSIoT/_apis/build/latest/$2?api-version=6.0-preview.1" | ||
rsp=$(curl -u :$1 $restUrl | jq -r '.value| .[0]') | ||
status=$(echo $rsp | jq -r '.state') | ||
buildId=$(echo $rsp | jq -r '.id') | ||
echo "===== build id is: " $buildId | ||
echo "===== build pipeline status: " $status | ||
while [[ $countNum -le 50 && "$status" != "completed" ]] | ||
do | ||
sleep 1m | ||
rsp=$(curl -u :$1 $restUrl | jq -r '.value| .[0]') | ||
status=$(echo $rsp | jq -r '.state') | ||
echo "loop status" $status | ||
countNum=$(( $countNum + 1 )) | ||
done | ||
if [[ "$status" != "completed" ]] | ||
then | ||
exit 1 | ||
fi | ||
|
||
restUrl="https://dev.azure.com/mseng/VSIoT/_apis/build/builds/$buildId/artifacts?api-version=6.0" | ||
asset_rsp=$(curl -u :$1 $restUrl) | ||
echo "====== asset url response:" $asset_rsp | ||
asset_id=$(echo $asset_rsp | jq '.value |.[] | .resource' |jq '.data' | tr -d -c 0-9) | ||
echo "====== asset id is: " $asset_id |
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,75 @@ | ||
const fs = require("fs"); | ||
const path = require("path") | ||
const simpleauth = path.join(__dirname, "../../packages/simpleauth") | ||
const xml2js = require(path.join(simpleauth, "node_modules/xml2js")) | ||
const csprojFile = path.join(simpleauth, "src/TeamsFxSimpleAuth/Microsoft.TeamsFx.SimpleAuth.csproj"); | ||
const simpleauthVer = require(path.join(simpleauth, "package.json")).version | ||
console.log("===== simple auth version: ", simpleauthVer) | ||
// update .csproj file | ||
fs.readFile(csprojFile, "utf-8", (err, data) => { | ||
if (err) { | ||
throw err; | ||
} | ||
|
||
// convert XML data to JSON object | ||
xml2js.parseString(data, (err, result) => { | ||
if (err) { | ||
throw err; | ||
} | ||
|
||
// replace `version` with new version | ||
for(let prop of result['Project'].PropertyGroup) { | ||
if(prop.Version) { | ||
prop.Version[0] = simpleauthVer; | ||
break; | ||
} | ||
} | ||
// convert SJON objec to XML | ||
const builder = new xml2js.Builder({trim: true, headless: true}); | ||
const xml = builder.buildObject(result); | ||
|
||
// write updated XML string to a file | ||
fs.writeFile(csprojFile, xml, (err) => { | ||
if (err) { | ||
throw err; | ||
} | ||
console.log(`Updated XML is written to a new file.`); | ||
}); | ||
|
||
}); | ||
}); | ||
|
||
const synup = process.env.SkipSyncup | ||
if(synup && synup.includes("fx-core")) { | ||
return; | ||
} | ||
|
||
// update fx-core tempaltes version.txt file | ||
const fxCorePath = path.join(__dirname, "../../packages/fx-core"); | ||
const simpleauthVerTxt = path.join(fxCorePath, "./templates/plugins/resource/simpleauth/version.txt") | ||
fs.writeFileSync(simpleauthVerTxt, simpleauthVer, "utf8") | ||
|
||
// only rc and stable release bump up version on main branch, rarely run. | ||
let needBumpUp = process.argv[2] === "yes" ? true : false; | ||
if (needBumpUp) { | ||
let file = path.join(fxCorePath, "package.json"); | ||
let pkg_ = fse.readJsonSync(file); | ||
let ver = pkg_.version; | ||
if (semver.prerelease(simpleauthVer)) { | ||
ver = semver.inc(ver, "prerelease", "rc"); | ||
} else { | ||
ver = semver.inc(ver, "patch"); | ||
} | ||
|
||
pkg_.version = ver; | ||
fse.writeFileSync(file, JSON.stringify(pkg_, null, 4)); | ||
|
||
file = path.join(fxCorePath, "package-lock.json"); | ||
if (file) { | ||
pkg_ = fse.readJsonSync(file); | ||
pkg_.version = ver; | ||
fse.writeFileSync(file, JSON.stringify(pkg_, null, 4)) | ||
} | ||
|
||
console.log("bump up fx-core version as ", ver); | ||
} |
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
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
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
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
Oops, something went wrong.