modify: edit CI/CD #50
Workflow file for this run
This file contains hidden or 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: .NET CI/CD | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*' | |
| release: | |
| types: [created] | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| if: startsWith(github.ref, 'refs/tags/') == false && contains(github.event.head_commit.message, '[no ci]') == false | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v3 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Install dependencies | |
| run: nuget restore | |
| - name: Build | |
| run: dotnet build -c Release -p:DebugType=None -p:DebugSymbols=false | |
| publish: | |
| runs-on: windows-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v3 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Install dependencies | |
| run: nuget restore | |
| - name: Build | |
| run: dotnet publish -c Release -p:DebugType=None -p:DebugSymbols=false | |
| # TODO! Create additional taks to pack required dependency assemblies when database support is added | |
| # - MySqlConnector.dll | |
| # - Npgsql.dll | |
| - name: Create release artifacts | |
| run: | | |
| mkdir artifacts | |
| mkdir artifacts\shared\MapChooserSharp.API\ | |
| mkdir artifacts\plugins\MapChooserSharp\ | |
| mkdir artifacts\plugins\MapChooserSharp\runtimes\ | |
| mkdir artifacts\plugins\MapChooserSharp\lang\ | |
| Copy-Item -Path "MapChooserSharp\bin\Release\*\publish\runtimes" -Destination "artifacts\plugins\MapChooserSharp\runtimes" -Force | |
| Copy-Item -Path "MapChooserSharp\bin\Release\*\publish\Dapper.dll" -Destination "artifacts\plugins\MapChooserSharp\Dapper.dll" -Force | |
| Copy-Item -Path "MapChooserSharp\bin\Release\*\publish\System.Data.SQLite.dll" -Destination "artifacts\plugins\MapChooserSharp\System.Data.SQLite.dll" -Force | |
| Copy-Item -Path "MapChooserSharp\bin\Release\*\MapChooserSharp.dll" -Destination "artifacts\plugins\MapChooserSharp\MapChooserSharp.dll" -Force | |
| Copy-Item -Path "MapChooserSharp.API\bin\Release\*\MapChooserSharp.API.dll" -Destination "artifacts\shared\MapChooserSharp.API\MapChooserSharp.API.dll" -Force | |
| Copy-Item -Path "lang\" -Destination "artifacts\plugins\MapChooserSharp\lang\" -Recurse -Force | |
| - name: Compress artifacts | |
| run: | |
| Compress-Archive -Path artifacts/* -Destination MapChooserSharp.zip | |
| - name: Upload release assets | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release-artifacts | |
| path: MapChooserSharp.zip | |
| release: | |
| runs-on: windows-latest | |
| needs: publish | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v2 | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: release-artifacts | |
| path: artifacts/ | |
| - name: check files | |
| run : | | |
| tree | |
| - name: Create Release and Upload Asset | |
| run: | | |
| gh release create "${{ github.ref_name }}" --title "Release ${{ github.ref_name }}" --generate-notes --draft=false artifacts/MapChooserSharp.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |