name: main on: [push, pull_request] jobs: test: runs-on: windows-latest env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true DOTNET_NOLOGO: true DOTNET_CLI_TELEMETRY_OPTOUT: true steps: - name: Checkout uses: actions/checkout@v3 - name: Install .NET uses: actions/setup-dotnet@v2 with: dotnet-version: 7.0.x - name: Run tests # Tests need access to secrets, so we can't run them against PRs because of limited trust if: ${{ github.event_name != 'pull_request' }} run: > dotnet test --configuration Release --logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true" --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover env: DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }} - name: Upload coverage uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} package: needs: test runs-on: windows-latest env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true DOTNET_NOLOGO: true DOTNET_CLI_TELEMETRY_OPTOUT: true steps: - name: Checkout uses: actions/checkout@v3 - name: Install .NET uses: actions/setup-dotnet@v2 with: dotnet-version: 7.0.x - name: Publish (CLI) run: > dotnet publish DiscordChatExporter.Cli --output DiscordChatExporter.Cli/publish/ --configuration Release - name: Publish (GUI) run: > dotnet publish DiscordChatExporter.Gui --output DiscordChatExporter.Gui/publish/ --configuration Release - name: Upload artifacts (CLI) uses: actions/upload-artifact@v3 with: name: DiscordChatExporter.Cli path: DiscordChatExporter.Cli/publish/ - name: Upload artifacts (GUI) uses: actions/upload-artifact@v3 with: name: DiscordChatExporter path: DiscordChatExporter.Gui/publish/ deploy: if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }} needs: package runs-on: ubuntu-latest steps: - name: Download artifacts (CLI) uses: actions/download-artifact@v3 with: name: DiscordChatExporter.Cli path: DiscordChatExporter.Cli - name: Download artifacts (GUI) uses: actions/download-artifact@v3 with: name: DiscordChatExporter path: DiscordChatExporter.Gui - name: Create package (CLI) shell: pwsh run: > Compress-Archive -Path DiscordChatExporter.Cli/* -DestinationPath DiscordChatExporter.Cli.zip -Force - name: Create package (GUI) shell: pwsh run: > Compress-Archive -Path DiscordChatExporter.Gui/* -DestinationPath DiscordChatExporter.zip -Force - name: Create release uses: softprops/action-gh-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: files: | DiscordChatExporter.Cli.zip DiscordChatExporter.zip body: | [Changelog](https://github.com/Tyrrrz/DiscordChatExporter/blob/master/Changelog.md) notify: needs: deploy runs-on: ubuntu-latest steps: - name: Get release version id: get-version uses: tyrrrz/action-get-tag@v1 - name: Notify Discord uses: tyrrrz/action-http-request@v1 with: url: ${{ secrets.DISCORD_WEBHOOK }} method: POST headers: | Content-Type: application/json; charset=UTF-8 body: | { "content": "**DiscordChatExporter** new version released!\nVersion: `${{ steps.get-version.outputs.tag }}`\nChangelog: " }