Bump csharpier from 0.30.3 to 0.30.4 (#178) #35
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: Deploy | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Build | |
runs-on: windows-latest | |
outputs: | |
solution: ${{ steps.outvars.outputs.solution }} | |
fullSemVer: ${{ steps.gitversion.outputs.fullSemVer }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: "8.0.x" | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
versionSpec: "5.x" | |
- name: Determine Version | |
id: gitversion | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
useConfigFile: true | |
updateAssemblyInfo: true | |
- name: Set up Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "temurin" | |
java-version: 21 | |
- name: Set environment variables | |
id: envvars | |
run: | | |
echo "solution=$([io.path]::GetFileNameWithoutExtension($(Get-ChildItem -Path .\* -Include *.sln)))" | Out-File -FilePath $env:GITHUB_ENV -Append | |
echo "projectPath=$((Get-ChildItem -Path .\Src\ -Directory | Select-Object -First 1).Name)" | Out-File -FilePath $env:GITHUB_ENV -Append | |
echo "sonar_key=$("${{ github.repository }}" -replace "/","_")" | Out-File -FilePath $env:GITHUB_ENV -Append | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v4 | |
with: | |
path: ~\sonar\cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Cache SonarCloud scanner | |
id: cache-sonar-scanner | |
uses: actions/cache@v4 | |
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 solution | |
run: dotnet build -c Release | |
- name: Run tests | |
run: dotnet test -c Release --no-build --no-restore | |
- name: Publish | |
run: dotnet publish -c Release -o Publish\Core --no-build --no-restore Src/${{ env.projectPath }}/${{ env.projectPath }}.csproj | |
- name: Set env variables to output | |
id: outvars | |
run: echo "solution=${{ env.solution }}" >> $env:GITHUB_OUTPUT | |
- name: Upload Core artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Core | |
path: Publish\Core | |
deploy_core: | |
name: Deploy Core | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: Core | |
- name: Upload to ftp | |
uses: sebastianpopp/ftp-action@releases/v2 | |
with: | |
host: ${{ secrets.FTP_SERVER }} | |
user: ${{ secrets.FTP_USERNAME }} | |
password: ${{ secrets.FTP_PASSWORD }} | |
remoteDir: Core | |
forceSsl: true | |
create_release: | |
name: Create Release | |
needs: [build, deploy_core] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifact Core | |
uses: actions/download-artifact@v4 | |
with: | |
name: Core | |
path: Core | |
- name: Zip artifact | |
run: | | |
zip -r Core.zip ./Core/* | |
- name: Create Release | |
uses: ncipollo/[email protected] | |
id: create_release | |
with: | |
allowUpdates: true | |
draft: false | |
makeLatest: true | |
tag: v${{ env.fullSemVer }} | |
name: Release v${{ env.fullSemVer }} | |
generateReleaseNotes: true | |
body: Release ${{ env.fullSemVer }} of ${{ github.repository }} | |
- name: Upload Core | |
id: upload_core | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./Core.zip | |
asset_name: Core.zip | |
asset_content_type: application/zip | |
- name: Send Webhook | |
uses: distributhor/workflow-webhook@v3 | |
with: | |
webhook_type: "json-extended" | |
event_name: "release" | |
webhook_url: ${{ secrets.RELEASE_WEBHOOK_URL }} | |
webhook_secret: '{"x-github-release-token": "${{ secrets.RELEASE_WEBHOOK_TOKEN }}"}' | |
data: '{ "tag_name": "v${{ env.fullSemVer }}", "assets": [{ "name" : "Core.zip", "browser_download_url": "${{ steps.upload_core.outputs.browser_download_url }}" } ] }' | |
cleanup: | |
name: Cleanup | |
needs: create_release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Remove artifacts | |
uses: geekyeggo/delete-artifact@v5 | |
with: | |
name: "*" |