File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4141 username : ${{ secrets.DOCKER_USERNAME }}
4242 password : ${{ secrets.DOCKER_PASSWORD }}
4343
44+ - name : Extract version from Directory.Packages.props
45+ id : get_version
46+ run : |
47+ # Extract Version and VersionSuffix from Directory.Packages.props
48+ VERSION_TEMPLATE=$(grep -oP '(?<=<Version>)[^<]*' Directory.Packages.props)
49+ VERSION_SUFFIX=$(grep -oP '(?<=<VersionSuffix>)[^<]*' Directory.Packages.props)
50+
51+ # Replace $(VersionSuffix) with actual value
52+ VERSION=$(echo "$VERSION_TEMPLATE" | sed "s/\$(VersionSuffix)/$VERSION_SUFFIX/g")
53+
54+ echo "version=$VERSION" >> $GITHUB_OUTPUT
55+ echo "Extracted version template: $VERSION_TEMPLATE"
56+ echo "Version suffix: $VERSION_SUFFIX"
57+ echo "Final version: $VERSION"
4458
4559 - name : Build and push koala-wiki
4660 uses : docker/build-push-action@v5
5165 push : true
5266 tags : |
5367 crpi-j9ha7sxwhatgtvj4.cn-shenzhen.personal.cr.aliyuncs.com/koala-ai/koala-wiki:latest
54- crpi-j9ha7sxwhatgtvj4.cn-shenzhen.personal.cr.aliyuncs.com/koala-ai/koala-wiki:0.9.0
68+ crpi-j9ha7sxwhatgtvj4.cn-shenzhen.personal.cr.aliyuncs.com/koala-ai/koala-wiki:${{ steps.get_version.outputs.version }}
Original file line number Diff line number Diff line change @@ -229,9 +229,12 @@ jobs:
229229 if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
230230 echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
231231 else
232- # 从Directory.Packages.props文件中提取版本号
233- version=$(powershell -Command "[xml]\$xml = Get-Content 'Directory.Packages.props'; \$xml.Project.PropertyGroup.Version")
234- echo "version=v$version" >> $GITHUB_OUTPUT
232+ # 从Directory.Packages.props文件中提取版本号并解析MSBuild变量
233+ VERSION_TEMPLATE=$(grep -oP '(?<=<Version>)[^<]*' Directory.Packages.props)
234+ VERSION_SUFFIX=$(grep -oP '(?<=<VersionSuffix>)[^<]*' Directory.Packages.props)
235+ VERSION=$(echo "$VERSION_TEMPLATE" | sed "s/\$(VersionSuffix)/$VERSION_SUFFIX/g")
236+ echo "version=v$VERSION" >> $GITHUB_OUTPUT
237+ echo "Extracted version: $VERSION"
235238 fi
236239 shell : bash
237240
You can’t perform that action at this time.
0 commit comments