Use GitHub actions

This commit is contained in:
Alexey Golub 2019-11-06 20:34:59 +02:00
parent 9299b95250
commit 1bf9d9e2e2
5 changed files with 100 additions and 79 deletions

64
.github/workflows/CD.yml vendored Normal file
View file

@ -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

34
.github/workflows/CI.yml vendored Normal file
View file

@ -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/

View file

@ -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

View file

@ -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

View file

@ -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