Fixes publish script to work with zsh (#218)
Fixes the publish script so it works with zsh and bash. (bump release)
This commit is contained in:
parent
dbca97e1c2
commit
dcbbb13e72
3 changed files with 60 additions and 8 deletions
2
.gitattributes
vendored
2
.gitattributes
vendored
|
|
@ -3,6 +3,8 @@
|
|||
*.cs text diff=csharp
|
||||
*.csproj text eol=crlf
|
||||
*.json text eol=lf
|
||||
*.md text eol=lf
|
||||
*.sh text eol=lf
|
||||
*.sln text eol=crlf
|
||||
*.yml text eol=lf
|
||||
publish.cmd text eol=lf
|
||||
|
|
|
|||
45
.github/workflows/sonar-cloud.yml
vendored
Normal file
45
.github/workflows/sonar-cloud.yml
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
name: Build
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
|
||||
jobs:
|
||||
sonar_cloud:
|
||||
name: Sonar Cloud
|
||||
if: "false"
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||
- name: Cache SonarCloud packages
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~\sonar\cache
|
||||
key: ${{ runner.os }}-sonar
|
||||
restore-keys: ${{ runner.os }}-sonar
|
||||
- name: Cache SonarCloud scanner
|
||||
id: cache-sonar-scanner
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: .\.sonar\scanner
|
||||
key: ${{ runner.os }}-sonar-scanner
|
||||
restore-keys: ${{ runner.os }}-sonar-scanner
|
||||
- name: Install SonarCloud scanner
|
||||
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
|
||||
shell: powershell
|
||||
run: |
|
||||
New-Item -Path .\.sonar\scanner -ItemType Directory
|
||||
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
|
||||
- name: Build and analyze
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
shell: powershell
|
||||
run: |
|
||||
.\.sonar\scanner\dotnet-sonarscanner begin /k:"modernuo_ModernUO" /o:"modernuo" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
|
||||
.\publish.cmd win core Release
|
||||
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
|
||||
21
publish.cmd
21
publish.cmd
|
|
@ -1,4 +1,3 @@
|
|||
#!/usr/bin/env bash
|
||||
dotnet restore --force-evaluate
|
||||
|
||||
:<<"::SHELLSCRIPT"
|
||||
|
|
@ -6,25 +5,31 @@ dotnet restore --force-evaluate
|
|||
GOTO :CMDSCRIPT
|
||||
|
||||
::SHELLSCRIPT
|
||||
if [[ $1 ]]; then
|
||||
r="-r $1-x64"
|
||||
os=$1
|
||||
|
||||
if [[ $os ]]; then
|
||||
r="-r $os-x64"
|
||||
elif [[ $(uname) = "Darwin" ]]; then
|
||||
r="-r osx-x64"
|
||||
elif [[ -f /etc/os-release ]]; then
|
||||
. /etc/os-release
|
||||
r="-r ${NAME,,}.$VERSION_ID-x64"
|
||||
NAME="$(tr '[:upper:]' '[:lower:]' <<< $NAME)"
|
||||
r="-r $NAME.$VERSION_ID-x64"
|
||||
fi
|
||||
|
||||
if [[ -z $2 ]] || [[ ${2,,} = "core" ]]; then
|
||||
f="-f netcoreapp3.1"
|
||||
else
|
||||
framework="$(tr '[:upper:]' '[:lower:]' <<< $2)"
|
||||
|
||||
if [[ $framework = "net" ]]; then
|
||||
f="-f net5.0"
|
||||
else
|
||||
f="-f netcoreapp3.1"
|
||||
fi
|
||||
|
||||
if [[ -z $3 ]]; then
|
||||
c="-c Release"
|
||||
else
|
||||
c="-c ${3^}"
|
||||
config="$(tr '[:lower:]' '[:upper:]' <<< ${3:0:1})${3:1}"
|
||||
c="-c $config"
|
||||
fi
|
||||
|
||||
echo dotnet publish ${c} ${r} ${f} --no-restore --self-contained=false -o Distribution Projects/Server/Server.csproj
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue