From 1bf9d9e2e211ad7e3044fb243d0c0f7fcaa3d950 Mon Sep 17 00:00:00 2001 From: Alexey Golub Date: Wed, 6 Nov 2019 20:34:59 +0200 Subject: [PATCH] Use GitHub actions --- .github/workflows/CD.yml | 64 ++++++++++++++++++++++++++++++++++++++++ .github/workflows/CI.yml | 34 +++++++++++++++++++++ Deploy/Prepare.ps1 | 48 ------------------------------ Readme.md | 4 +-- appveyor.yml | 29 ------------------ 5 files changed, 100 insertions(+), 79 deletions(-) create mode 100644 .github/workflows/CD.yml create mode 100644 .github/workflows/CI.yml delete mode 100644 Deploy/Prepare.ps1 delete mode 100644 appveyor.yml diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml new file mode 100644 index 0000000..5d3eb7e --- /dev/null +++ b/.github/workflows/CD.yml @@ -0,0 +1,64 @@ +name: CD + +on: + push: + tags: + - '*' + +jobs: + build: + runs-on: windows-latest + + steps: + - name: Checkout + uses: actions/checkout@v1 + + - name: Install .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 3.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.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + draft: false + prerelease: false + + - name: Upload release asset (CLI) + uses: actions/upload-release-asset@v1.0.1 + 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.1 + 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 diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..8a66fdc --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,34 @@ +name: CI + +on: [push, pull_request] + +jobs: + build: + runs-on: windows-latest + + steps: + - name: Checkout + uses: actions/checkout@v1 + + - name: Install .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 3.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: Upload build artifacts (CLI) + uses: actions/upload-artifact@master + with: + name: DiscordChatExporter.CLI + path: DiscordChatExporter.Cli/bin/Publish/ + + - name: Upload build artifact (GUI) + uses: actions/upload-artifact@master + with: + name: DiscordChatExporter + path: DiscordChatExporter.Gui/bin/Publish/ diff --git a/Deploy/Prepare.ps1 b/Deploy/Prepare.ps1 deleted file mode 100644 index c40fa13..0000000 --- a/Deploy/Prepare.ps1 +++ /dev/null @@ -1,48 +0,0 @@ -# -- GUI -- - -$licenseFilePath = "$PSScriptRoot/../License.txt" - -$projectDirPath = "$PSScriptRoot/../DiscordChatExporter.Gui" -$publishDirPath = "$PSScriptRoot/bin/build/" -$artifactFilePath = "$PSScriptRoot/bin/DiscordChatExporter.zip" - -# Prepare directory -if (Test-Path $publishDirPath) { - Remove-Item $publishDirPath -Recurse -Force -} -New-Item $publishDirPath -ItemType Directory -Force - -# Build & publish -dotnet publish $projectDirPath -o $publishDirPath -c Release | Out-Host - -$files = @() -$files += Get-Item -Path $licenseFilePath -$files += Get-ChildItem -Path $publishDirPath - -# Pack into archive -$files | Compress-Archive -DestinationPath $artifactFilePath -Force - - -# -- CLI -- - -$licenseFilePath = "$PSScriptRoot/../License.txt" - -$projectDirPath = "$PSScriptRoot/../DiscordChatExporter.Cli" -$publishDirPath = "$PSScriptRoot/bin/build/" -$artifactFilePath = "$PSScriptRoot/bin/DiscordChatExporter.Cli.zip" - -# Prepare directory -if (Test-Path $publishDirPath) { - Remove-Item $publishDirPath -Recurse -Force -} -New-Item $publishDirPath -ItemType Directory -Force - -# Build & publish -dotnet publish $projectDirPath -o $publishDirPath -c Release | Out-Host - -$files = @() -$files += Get-Item -Path $licenseFilePath -$files += Get-ChildItem -Path $publishDirPath - -# Pack into archive -$files | Compress-Archive -DestinationPath $artifactFilePath -Force \ No newline at end of file diff --git a/Readme.md b/Readme.md index 8d635b9..adae5d4 100644 --- a/Readme.md +++ b/Readme.md @@ -1,6 +1,6 @@ # DiscordChatExporter -[![Build](https://img.shields.io/appveyor/ci/Tyrrrz/DiscordChatExporter/master.svg)](https://ci.appveyor.com/project/Tyrrrz/DiscordChatExporter) +[![Build](https://github.com/Tyrrrz/DiscordChatExporter/workflows/CI/badge.svg?branch=master)](https://github.com/Tyrrrz/DiscordChatExporter/actions) [![Release](https://img.shields.io/github/release/Tyrrrz/DiscordChatExporter.svg)](https://github.com/Tyrrrz/DiscordChatExporter/releases) [![Downloads](https://img.shields.io/github/downloads/Tyrrrz/DiscordChatExporter/total.svg)](https://github.com/Tyrrrz/DiscordChatExporter/releases) [![Donate](https://img.shields.io/badge/patreon-donate-yellow.svg)](https://patreon.com/tyrrrz) @@ -12,7 +12,7 @@ DiscordChatExporter can be used to export message history from a [Discord](https - **[Latest release](https://github.com/Tyrrrz/DiscordChatExporter/releases/latest)** - [Docker image](https://hub.docker.com/r/tyrrrz/discordchatexporter): `docker pull tyrrrz/discordchatexporter` -- [CI build](https://ci.appveyor.com/project/Tyrrrz/DiscordChatExporter/branch/master/artifacts) +- [CI build](https://github.com/Tyrrrz/DiscordChatExporter/actions) ## Features diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 62f1f24..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,29 +0,0 @@ -version: '{build}' - -image: Visual Studio 2019 -configuration: Release - -before_build: -- ps: nuget restore - -build: - verbosity: minimal - -after_build: -- ps: Deploy/Prepare.ps1 - -artifacts: -- path: Deploy/bin/DiscordChatExporter.zip - name: DiscordChatExporter.zip -- path: Deploy/bin/DiscordChatExporter.CLI.zip - name: DiscordChatExporter.CLI.zip - -deploy: -- provider: GitHub - auth_token: - secure: sjQHWRw29AMiVMn3MtidtWnAzAf1mJ+mkJ/7h1B9TIAHhkFrqwMK7LtXV+uNJ9AO - artifact: DiscordChatExporter.zip,DiscordChatExporter.CLI.zip - description: '[Changelog](https://github.com/Tyrrrz/DiscordChatExporter/blob/master/Changelog.md)' - on: - branch: master - appveyor_repo_tag: true \ No newline at end of file