staticsharp_core_updated #45
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: update StaticSharp.Core reference | |
on: | |
push: | |
branches: | |
- main | |
repository_dispatch: | |
types: [staticsharp_core_updated] | |
workflow_dispatch: | |
jobs: | |
updatePackage: | |
name: Update package in DefaultStaticSharpProjectTemplate | |
runs-on: ubuntu-22.04 | |
if: github.event_name == 'repository_dispatch' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Update StaticSharp.Core in DefaultStaticSharpProjectTemplate | |
run: | | |
echo "Target package version ${{ github.event.client_payload.package_version }}" | |
echo "Retrying until package is validated and ready..." | |
set +e #####disables exit on non-zero exit code (needed for retries) | |
retries=3000 | |
while ((retries>0)); do | |
echo "retries remaining: $retries" | |
dotnet nuget locals all --clear \ | |
> /dev/null 2>&1 | |
dotnet add ./ProjectTemplates/DefaultStaticSharpProjectTemplate/DefaultStaticSharpProjectTemplate.csproj package StaticSharp.Core \ | |
--source https://api.nuget.org/v3/index.json \ | |
--version ${{ github.event.client_payload.package_version }} \ | |
> /dev/null 2>&1 | |
if (($?==0)); then | |
break; | |
fi; | |
sleep 2; | |
((retries--)) | |
done | |
if ((retries==0)); then | |
echo "Failed!" | |
exit 1 | |
fi; | |
- name: Commit | |
run: | | |
git config user.email "[email protected]" | |
git config user.name "Github actions" | |
git commit -a -m "StaticSharp.Core updated to version ${{ github.event.client_payload.package_version }}" | |
git push | |
- name: Build | |
run: | | |
dotnet build ./ProjectTemplates/DefaultStaticSharpProjectTemplate/DefaultStaticSharpProjectTemplate.csproj | |
- name: Trigger VsCode extension update | |
run: | | |
curl -L -i \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
-H "Authorization: Bearer ${{ secrets.PAT_REPOSITORY_DISPATCH }}" \ | |
-d '{"event_type":"templates_updated"}' \ | |
https://api.github.com/repos/StaticSharp/StaticSharpVsCodeExtension/dispatches | |
updateTemplates: | |
name: Update DefaultStaticSharpProjectTemplate | |
runs-on: ubuntu-22.04 | |
if: github.event_name == 'push' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v1 | |
- name: Build | |
run: | | |
dotnet build ./ProjectTemplates/DefaultStaticSharpProjectTemplate/DefaultStaticSharpProjectTemplate.csproj | |
- name: Trigger VsCode extension update | |
run: | | |
curl -L -i \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
-H "Authorization: Bearer ${{ secrets.PAT_REPOSITORY_DISPATCH }}" \ | |
-d '{"event_type":"templates_updated"}' \ | |
https://api.github.com/repos/StaticSharp/StaticSharpVsCodeExtension/dispatches | |
build: | |
name: Re-build DefaultStaticSharpProjectTemplate | |
if: github.event_name == 'workflow_dispatch' | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v1 | |
- name: Update StaticSharp.Core in DefaultStaticSharpProjectTemplate to latest | |
run: | | |
dotnet nuget locals all --clear | |
dotnet add ./ProjectTemplates/DefaultStaticSharpProjectTemplate/DefaultStaticSharpProjectTemplate.csproj package StaticSharp.Core \ | |
--source https://api.nuget.org/v3/index.json \ | |
- name: Build | |
run: | | |
dotnet build ./ProjectTemplates/DefaultStaticSharpProjectTemplate/DefaultStaticSharpProjectTemplate.csproj | |