Skip to content

Commit 9f62f36

Browse files
committed
gh action
1 parent f6f44f6 commit 9f62f36

File tree

3 files changed

+137
-1
lines changed

3 files changed

+137
-1
lines changed

.github/workflows/build-debug.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Build-Debug
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
tags:
8+
- "!*" # not a tag push
9+
pull_request:
10+
types:
11+
- opened
12+
- synchronize
13+
14+
jobs:
15+
build-dotnet:
16+
runs-on: ubuntu-latest
17+
env:
18+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
19+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
20+
NUGET_XMLDOC_MODE: skip
21+
steps:
22+
- uses: actions/checkout@v2
23+
- uses: actions/setup-dotnet@v1
24+
with:
25+
dotnet-version: 3.1.101
26+
27+
- run: dotnet build -c Debug
28+
- run: dotnet test -c Debug --no-build < /dev/null
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: Build-Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "[0-9]+.[0-9]+.[0-9]+*"
7+
8+
jobs:
9+
build-dotnet:
10+
runs-on: ubuntu-latest
11+
env:
12+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
13+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
14+
NUGET_XMLDOC_MODE: skip
15+
steps:
16+
- uses: actions/checkout@v2
17+
- uses: actions/setup-dotnet@v1
18+
with:
19+
dotnet-version: 3.1.101
20+
# set release tag(*.*.*) to env.GIT_TAG
21+
- run: echo ::set-env name=GIT_TAG::${GITHUB_REF#refs/tags/}
22+
23+
# build CommandTools first (use dotnet run command in ZLogger.csproj)
24+
- run: dotnet build -c Release ./tools/CommandTools/CommandTools.csproj
25+
- run: dotnet build -c Release -p:Version=${{ env.GIT_TAG }}
26+
- run: dotnet test -c Release --no-build
27+
- run: dotnet pack ./src/ZLogger/ZLogger.csproj -c Release --no-build -p:Version=${{ env.GIT_TAG }}
28+
29+
# Store artifacts.
30+
- uses: actions/upload-artifact@v1
31+
with:
32+
name: nuget
33+
path: ./src/ZLogger/bin/Release/ZLogger.${{ env.GIT_TAG }}.nupkg
34+
35+
build-unity:
36+
strategy:
37+
matrix:
38+
unity: ['2019.3.9f1']
39+
include:
40+
- unity: 2019.3.9f1
41+
license: UNITY_2019_3
42+
runs-on: ubuntu-latest
43+
container:
44+
# with linux-il2cpp. image from https://hub.docker.com/r/gableroux/unity3d/tags
45+
image: gableroux/unity3d:${{ matrix.unity }}-linux-il2cpp
46+
steps:
47+
- run: apt update && apt install git -y
48+
- uses: actions/checkout@v2
49+
- run: echo -n "$UNITY_LICENSE" >> .Unity.ulf
50+
env:
51+
UNITY_LICENSE: ${{ secrets[matrix.license] }}
52+
- run: /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -manualLicenseFile .Unity.ulf || exit 0
53+
54+
# set release tag(*.*.*) to env.GIT_TAG
55+
- run: echo ::set-env name=GIT_TAG::${GITHUB_REF#refs/tags/}
56+
57+
# Execute scripts: Export Package
58+
- name: Export unitypackage
59+
run: /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export
60+
working-directory: src/ZLogger.Unity
61+
env:
62+
UNITY_PACKAGE_VERSION: ${{ env.GIT_TAG }}
63+
64+
# Store artifacts.
65+
- uses: actions/upload-artifact@v1
66+
with:
67+
name: ZLogger.Unity.${{ env.GIT_TAG }}.unitypackage
68+
path: ./src/ZLogger.Unity/ZLogger.Unity.${{ env.GIT_TAG }}.unitypackage
69+
70+
create-release:
71+
needs: [build-dotnet, build-unity]
72+
runs-on: ubuntu-latest
73+
env:
74+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
75+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
76+
NUGET_XMLDOC_MODE: skip
77+
steps:
78+
# setup dotnet for nuget push
79+
- uses: actions/setup-dotnet@v1
80+
with:
81+
dotnet-version: 3.1.101
82+
# set release tag(*.*.*) to env.GIT_TAG
83+
- run: echo ::set-env name=GIT_TAG::${GITHUB_REF#refs/tags/}
84+
85+
# Create Releases
86+
- uses: actions/create-release@v1
87+
id: create_release
88+
env:
89+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90+
with:
91+
tag_name: ${{ github.ref }}
92+
release_name: Ver.${{ github.ref }}
93+
94+
# Download (All) Artifacts to current directory
95+
- uses: actions/download-artifact@v2-preview
96+
97+
# Upload to NuGet
98+
- run: dotnet nuget push "./nuget/*.nupkg" -s https://www.nuget.org/api/v2/package -k ${{ secrets.NUGET_KEY }}
99+
100+
# Upload to Releases(unitypackage)
101+
- uses: actions/upload-release-asset@v1
102+
env:
103+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104+
with:
105+
upload_url: ${{ steps.create_release.outputs.upload_url }}
106+
asset_path: ./ZLogger.Unity.${{ env.GIT_TAG }}.unitypackage/ZLogger.Unity.${{ env.GIT_TAG }}.unitypackage
107+
asset_name: ZLogger.Unity.${{ env.GIT_TAG }}.unitypackage
108+
asset_content_type: application/octet-stream

ReadMe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ConsoleAppFramework
22
===
3-
[![CircleCI](https://circleci.com/gh/Cysharp/ConsoleAppFramework.svg?style=svg)](https://circleci.com/gh/Cysharp/ConsoleAppFramework)
3+
[![GitHub Actions](https://github.com/Cysharp/ConsoleAppFramework/workflows/Build-Debug/badge.svg)](https://github.com/Cysharp/ConsoleAppFramework/actions) [![Releases](https://img.shields.io/github/release/Cysharp/ConsoleAppFramework.svg)](https://github.com/Cysharp/ConsoleAppFramework/releases)
44

55
ConsoleAppFramework is an infrastructure of creating CLI(Command-line interface) tools, daemon, and multi batch application.
66

0 commit comments

Comments
 (0)