Skip to content

Commit

Permalink
Add DotNet auto-build and Release on branch updates. + Configuration …
Browse files Browse the repository at this point in the history
…updates. (#4)

* [+] Enable Windows Targeting / Suppress TRIM errors

* [+] Auto-build "main" branch to Release

Auto-zips and releases. Can be configured for other branches.

* Create dotnet_build.yml

* Delete .workflows directory

* [+] Rewrite

I cannot get it to compile using Chinese Characters

* [-] Quick fixup
  • Loading branch information
cvyl authored Dec 30, 2023
1 parent 10926b5 commit d587489
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 1 deletion.
80 changes: 80 additions & 0 deletions .github/workflows/dotnet_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: .NET x64 Build, Test, Upload

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: windows-latest

steps:

- name: Checkout Repository
uses: actions/checkout@v2

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x

- name: Restore dependencies
run: dotnet restore

- name: Clone and build Vue.js project
run: |
git clone https://github.com/ks233/ja-learner-webview
cd ja-learner-webview
npm install
npm run build
mkdir -p ../ja-learner/dist_vue
mv dist ../ja-learner/dist_vue
- name: Build C# project for Windows
run: dotnet build ja-learner.sln -c Release --no-restore

#- name: Test C# project
# run: dotnet test --no-build --verbosity normal

- name: Move Vue.js dist to C# project
run: mv ja-learner/dist_vue/dist ./bin/Release/net6.0-windows/

- name: Download static files from repo
run: |
git clone https://github.com/ly-nld/ja-learner-static-files
mv ja-learner-static-files/* ./bin/Release/net6.0-windows/
mkdir ./bin/Release/net6.0-window/extra_prompts
- name: Create win client archive
run: Compress-Archive -Path ./bin/Release/net6.0-windows/* -DestinationPath client-win-x64.zip

- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y年%m月%d日%H%M%S')"

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: release-${{ steps.date.outputs.date }}
release_name: Release ${{ steps.date.outputs.date }}
draft: false
prerelease: false

- name: Upload Client win7-x64 Asset
id: upload-release-client-win-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./client-win-x64.zip
asset_name: ja-learner.zip
asset_content_type: application/zip
4 changes: 3 additions & 1 deletion ja-learner.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<RootNamespace>ja_learner</RootNamespace>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<_SuppressWinFormsTrimError>true</_SuppressWinFormsTrimError>
<ImplicitUsings>enable</ImplicitUsings>
<GenerateDocumentationFile>False</GenerateDocumentationFile>
<MeCabUseDefaultDictionary>False</MeCabUseDefaultDictionary>
Expand Down Expand Up @@ -47,4 +49,4 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
</Project>

0 comments on commit d587489

Please sign in to comment.