diff --git a/.github/workflows/CD-Docker.yml b/.github/workflows/CD-Docker.yml deleted file mode 100644 index 9e4cd58..0000000 --- a/.github/workflows/CD-Docker.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Docker CD - -on: - push: - tags: - - "*" - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v2.3.3 - - - name: Get release version - id: get_version - uses: dawidd6/action-get-tag@v1 - - - name: Login - run: docker login -u tyrrrz -p ${{ secrets.DOCKER_TOKEN }} - - - name: Build - run: docker build -t tyrrrz/discordchatexporter:${{ steps.get_version.outputs.tag }} -t tyrrrz/discordchatexporter:stable . - - - name: Deploy (version) - run: docker push tyrrrz/discordchatexporter:${{ steps.get_version.outputs.tag }} - - - name: Deploy (stable) - run: docker push tyrrrz/discordchatexporter:stable \ No newline at end of file diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml deleted file mode 100644 index b5af3cf..0000000 --- a/.github/workflows/CD.yml +++ /dev/null @@ -1,85 +0,0 @@ -name: CD - -on: - push: - tags: - - "*" - -jobs: - build: - runs-on: windows-latest - - steps: - - name: Checkout - uses: actions/checkout@v2.3.3 - - - name: Get release version - id: get_version - uses: dawidd6/action-get-tag@v1 - - - name: Install .NET - uses: actions/setup-dotnet@v1.7.2 - with: - # Fixed version, workaround for https://github.com/dotnet/core/issues/7176 - dotnet-version: 6.0.100 - - - name: Build & publish (CLI) - run: dotnet publish DiscordChatExporter.Cli/ -o DiscordChatExporter.Cli/bin/Publish/ --configuration Release - - - name: Build & publish (GUI) - run: dotnet publish DiscordChatExporter.Gui/ -o DiscordChatExporter.Gui/bin/Publish/ --configuration Release - - - name: Pack (CLI) - run: Compress-Archive -Path DiscordChatExporter.Cli/bin/Publish/* -DestinationPath DiscordChatExporter.Cli/bin/Publish/Archive.zip -Force - shell: pwsh - - - name: Pack (GUI) - run: Compress-Archive -Path DiscordChatExporter.Gui/bin/Publish/* -DestinationPath DiscordChatExporter.Gui/bin/Publish/Archive.zip -Force - shell: pwsh - - - name: Create release - id: create_release - uses: actions/create-release@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - body: | - [Changelog](https://github.com/Tyrrrz/DiscordChatExporter/blob/master/Changelog.md) - draft: false - prerelease: false - - - name: Upload release asset (CLI) - uses: actions/upload-release-asset@v1.0.2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: DiscordChatExporter.Cli/bin/Publish/Archive.zip - asset_name: DiscordChatExporter.CLI.zip - asset_content_type: application/zip - - - name: Upload release asset (GUI) - uses: actions/upload-release-asset@v1.0.2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: DiscordChatExporter.Gui/bin/Publish/Archive.zip - asset_name: DiscordChatExporter.zip - asset_content_type: application/zip - - - name: Notify Discord - uses: satak/webrequest-action@v1.2.4 - with: - url: ${{ secrets.DISCORD_WEBHOOK }} - method: POST - headers: | - { - "ContentType": "application/json; charset=UTF-8" - } - payload: | - { - "content": "**DiscordChatExporter** new version released!\nVersion: `${{ steps.get_version.outputs.tag }}`\nChangelog: " - } \ No newline at end of file diff --git a/.github/workflows/CI-Docker.yml b/.github/workflows/CI-Docker.yml deleted file mode 100644 index cf95b6e..0000000 --- a/.github/workflows/CI-Docker.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Docker CI - -on: - push: - branches: - - master - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v2.3.3 - - - name: Login - run: docker login -u tyrrrz -p ${{ secrets.DOCKER_TOKEN }} - - - name: Build - run: docker build -t tyrrrz/discordchatexporter:latest . - - - name: Deploy (latest) - run: docker push tyrrrz/discordchatexporter:latest \ No newline at end of file diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml deleted file mode 100644 index c7d1ef4..0000000 --- a/.github/workflows/CI.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: CI - -on: [push, pull_request] - -jobs: - build: - runs-on: windows-latest - - steps: - - name: Checkout - uses: actions/checkout@v2.3.3 - - - name: Install .NET - uses: actions/setup-dotnet@v1.7.2 - with: - # Fixed version, workaround for https://github.com/dotnet/core/issues/7176 - dotnet-version: 6.0.100 - - - name: Build & test - # 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 --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover - env: - DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }} - DISCORD_TOKEN_BOT: true - - - name: Upload coverage - uses: codecov/codecov-action@v1.0.5 - with: - token: ${{ secrets.CODECOV_TOKEN }} - - - name: Build & publish (CLI) - run: dotnet publish DiscordChatExporter.Cli/ -o DiscordChatExporter.Cli/bin/Publish/ --configuration Release - - - name: Build & publish (GUI) - run: dotnet publish DiscordChatExporter.Gui/ -o DiscordChatExporter.Gui/bin/Publish/ --configuration Release - - - name: Upload build artifacts (CLI) - uses: actions/upload-artifact@v1 - with: - name: DiscordChatExporter.CLI - path: DiscordChatExporter.Cli/bin/Publish/ - - - name: Upload build artifact (GUI) - uses: actions/upload-artifact@v1 - with: - name: DiscordChatExporter - path: DiscordChatExporter.Gui/bin/Publish/ diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..bc73e4d --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,55 @@ +name: docker + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Build container + run: docker build . + + deploy-latest: + if: ${{ github.event_name == 'push' && github.ref_type == 'branch' && github.ref_name == 'master' }} + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Login to DockerHub + run: docker login -u tyrrrz -p ${{ secrets.DOCKER_TOKEN }} + + - name: Build container + run: docker build -t tyrrrz/discordchatexporter:latest . + + - name: Push container + run: docker push tyrrrz/discordchatexporter:latest + + deploy-stable: + if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }} + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Get release version + id: get_version + uses: dawidd6/action-get-tag@v1 + + - name: Login to DockerHub + run: docker login -u tyrrrz -p ${{ secrets.DOCKER_TOKEN }} + + - name: Build container + run: docker build -t tyrrrz/discordchatexporter:stable . + + - name: Push container (stable) + run: docker push tyrrrz/discordchatexporter:stable + + - name: Push container (${{ steps.get_version.outputs.tag }}) + run: docker push tyrrrz/discordchatexporter:${{ steps.get_version.outputs.tag }} \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..c856e64 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,157 @@ +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: + # Fixed version, workaround for https://github.com/dotnet/core/issues/7176 + dotnet-version: 6.0.100 + + - 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 --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover + env: + DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }} + DISCORD_TOKEN_BOT: true + + - name: Upload coverage + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + + publish: + 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: + # Fixed version, workaround for https://github.com/dotnet/core/issues/7176 + dotnet-version: 6.0.100 + + - name: Publish (CLI) + run: dotnet publish DiscordChatExporter.Cli/ -o DiscordChatExporter.Cli/bin/Publish/ --configuration Release + + - name: Publish (GUI) + run: dotnet publish DiscordChatExporter.Gui/ -o DiscordChatExporter.Gui/bin/Publish/ --configuration Release + + - name: Upload artifact (CLI) + uses: actions/upload-artifact@v3 + with: + name: DiscordChatExporter.CLI + path: DiscordChatExporter.Cli/bin/Publish/ + + - name: Upload artifact (GUI) + uses: actions/upload-artifact@v3 + with: + name: DiscordChatExporter + path: DiscordChatExporter.Gui/bin/Publish/ + + deploy: + if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }} + needs: publish + runs-on: ubuntu-latest + + steps: + - name: Download artifact (CLI) + uses: actions/download-artifact@v3 + with: + name: DiscordChatExporter.CLI + path: DiscordChatExporter.CLI + + - name: Download artifact (GUI) + uses: actions/download-artifact@v3 + with: + name: DiscordChatExporter + path: DiscordChatExporter.GUI + + - name: Create package (CLI) + run: Compress-Archive -Path DiscordChatExporter.CLI/* -DestinationPath DiscordChatExporter.CLI.zip -Force + shell: pwsh + + - name: Create package (GUI) + run: Compress-Archive -Path DiscordChatExporter.GUI/* -DestinationPath DiscordChatExporter.GUI.zip -Force + shell: pwsh + + - name: Create release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + body: | + [Changelog](https://github.com/Tyrrrz/DiscordChatExporter/blob/master/Changelog.md) + draft: false + prerelease: false + + - name: Upload release asset (CLI) + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_name: DiscordChatExporter.CLI.zip + asset_path: DiscordChatExporter.CLI.zip + asset_content_type: application/zip + + - name: Upload release asset (GUI) + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_name: DiscordChatExporter.zip + asset_path: DiscordChatExporter.GUI.zip + asset_content_type: application/zip + + notify: + needs: deploy + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Get release version + id: get_version + uses: dawidd6/action-get-tag@v1 + + - name: Notify Discord + uses: satak/webrequest-action@v1.2.4 + with: + url: ${{ secrets.DISCORD_WEBHOOK }} + method: POST + headers: | + { + "ContentType": "application/json; charset=UTF-8" + } + payload: | + { + "content": "**DiscordChatExporter** new version released!\nVersion: `${{ steps.get_version.outputs.tag }}`\nChangelog: " + } \ No newline at end of file