Add option to stop script gracefully #92
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: release | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'src/**' | |
- '!src/.editorconfig' | |
jobs: | |
build-extension: | |
runs-on: windows-latest | |
env: | |
DOTNET_NOLOGO: true | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
RepositoryUrl: 'https://github.com/${{ github.repository }}' | |
RepositoryBranch: '${{ github.ref }}' | |
SourceRevisionId: '${{ github.sha }}' | |
Configuration: Release | |
SolutionPath: ./src/ScriptRunner/ScriptRunner.sln | |
Deterministic: true | |
PackageReleaseNotes: 'https://github.com/${{ github.repository }}/releases' | |
ContinuousIntegrationBuild: true | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup .NET Core 6 | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '6.0.108' | |
- name: Calculate next version | |
uses: cezarypiatek/[email protected] | |
with: | |
minor-pattern: '.*' | |
major-pattern: 'BREAKING CHANGES' | |
output-to-env-variable: 'Version' | |
- name: Restore dependencies | |
run: | | |
dotnet nuget locals all --clear | |
dotnet restore $env:SolutionPath | |
- name: Build extension | |
shell: pwsh | |
run: | | |
New-Item -ItemType Directory -Name dist | |
dotnet build $env:SolutionPath | |
Copy-Item -Path src\ScriptRunner\ScriptRunner.GUI\bin\Release\ScriptRunnerGUI.${{ env.Version }}.nupkg -Destination ./dist/ | |
dotnet publish $env:SolutionPath -r win-x64 -p:PublishSingleFile=true -maxcpucount:1 --self-contained false -p:PublishReadyToRun=true | |
- name: Generate release note | |
run: | | |
git fetch --prune | |
$commitLog = git log "$(git describe --tags --abbrev=0)..HEAD" --pretty=format:"- %s" | |
$commitLog = if([string]::IsNullOrWhitespace($commitLog)){git log --pretty=format:"- %s"}else{$commitLog} | |
"What's new: `r`n`r`n$([string]::Join("`r`n",$commitLog))" | Out-File release_note.md -Encoding utf8 | |
- name: Compress artifacts | |
run: Compress-Archive -Path .\src\ScriptRunner\ScriptRunner.GUI\bin\Release\net6.0\win-x64\publish\* -DestinationPath ScriptRunner.${{ env.Version }}.zip | |
- name: Create Github Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.Version }} | |
release_name: ${{ env.Version }} | |
body_path: release_note.md | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ScriptRunner.${{ env.Version }}.zip | |
asset_name: ScriptRunner.${{ env.Version }}.zip | |
asset_content_type: binary/octet-stream | |
- name: Publish extension to Nuget | |
run: | | |
dotnet nuget push dist\ScriptRunnerGUI.${{ env.Version }}.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json |