Skip to content

Commit 3553fd0

Browse files
committed
add github actions
1 parent 4f82611 commit 3553fd0

3 files changed

Lines changed: 183 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
build:
12+
name: Publish (${{ matrix.rid }})
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
include:
18+
- os: ubuntu-latest
19+
rid: linux-x64
20+
- os: windows-latest
21+
rid: win-x64
22+
- os: windows-latest
23+
rid: win-x86
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
- name: Setup .NET
30+
uses: actions/setup-dotnet@v4
31+
with:
32+
global-json-file: global.json
33+
cache: true
34+
cache-dependency-path: |
35+
**/*.csproj
36+
37+
- name: Restore
38+
run: dotnet restore cge-tools.sln
39+
40+
- name: Publish (Linux)
41+
if: runner.os == 'Linux'
42+
env:
43+
RID: ${{ matrix.rid }}
44+
run: |
45+
set -euo pipefail
46+
rm -rf dist
47+
dotnet publish CftConverter/CftConverter.csproj -c Release -r "$RID" --self-contained false -o "dist/$RID/cft-converter"
48+
dotnet publish VbmConverter/VbmConverter.csproj -c Release -r "$RID" --self-contained false -o "dist/$RID/vbm-converter"
49+
50+
- name: Package (Linux)
51+
if: runner.os == 'Linux'
52+
env:
53+
RID: ${{ matrix.rid }}
54+
run: |
55+
set -euo pipefail
56+
cd "dist/$RID"
57+
zip -r "../../cge-tools-$RID.zip" .
58+
59+
- name: Publish (Windows)
60+
if: runner.os == 'Windows'
61+
shell: pwsh
62+
env:
63+
RID: ${{ matrix.rid }}
64+
run: |
65+
Remove-Item -Recurse -Force dist -ErrorAction SilentlyContinue
66+
dotnet publish CftConverter/CftConverter.csproj -c Release -r $env:RID --self-contained false -o dist/$env:RID/cft-converter
67+
dotnet publish VbmConverter/VbmConverter.csproj -c Release -r $env:RID --self-contained false -o dist/$env:RID/vbm-converter
68+
69+
- name: Package (Windows)
70+
if: runner.os == 'Windows'
71+
shell: pwsh
72+
env:
73+
RID: ${{ matrix.rid }}
74+
run: |
75+
Compress-Archive -Path dist/$env:RID/* -DestinationPath cge-tools-$env:RID.zip -Force
76+
77+
- name: Upload artifact
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: cge-tools-${{ matrix.rid }}
81+
path: cge-tools-${{ matrix.rid }}.zip

.github/workflows/release.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build:
13+
name: Build assets (${{ matrix.rid }})
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
include:
19+
- os: ubuntu-latest
20+
rid: linux-x64
21+
- os: windows-latest
22+
rid: win-x64
23+
- os: windows-latest
24+
rid: win-x86
25+
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
30+
- name: Setup .NET
31+
uses: actions/setup-dotnet@v4
32+
with:
33+
global-json-file: global.json
34+
cache: true
35+
cache-dependency-path: |
36+
**/*.csproj
37+
38+
- name: Restore
39+
run: dotnet restore cge-tools.sln
40+
41+
- name: Publish (Linux)
42+
if: runner.os == 'Linux'
43+
env:
44+
RID: ${{ matrix.rid }}
45+
run: |
46+
set -euo pipefail
47+
rm -rf dist
48+
dotnet publish CftConverter/CftConverter.csproj -c Release -r "$RID" --self-contained false -o "dist/$RID/cft-converter"
49+
dotnet publish VbmConverter/VbmConverter.csproj -c Release -r "$RID" --self-contained false -o "dist/$RID/vbm-converter"
50+
51+
- name: Package (Linux)
52+
if: runner.os == 'Linux'
53+
env:
54+
RID: ${{ matrix.rid }}
55+
run: |
56+
set -euo pipefail
57+
cd "dist/$RID"
58+
zip -r "../../cge-tools-$RID.zip" .
59+
60+
- name: Publish (Windows)
61+
if: runner.os == 'Windows'
62+
shell: pwsh
63+
env:
64+
RID: ${{ matrix.rid }}
65+
run: |
66+
Remove-Item -Recurse -Force dist -ErrorAction SilentlyContinue
67+
dotnet publish CftConverter/CftConverter.csproj -c Release -r $env:RID --self-contained false -o dist/$env:RID/cft-converter
68+
dotnet publish VbmConverter/VbmConverter.csproj -c Release -r $env:RID --self-contained false -o dist/$env:RID/vbm-converter
69+
70+
- name: Package (Windows)
71+
if: runner.os == 'Windows'
72+
shell: pwsh
73+
env:
74+
RID: ${{ matrix.rid }}
75+
run: |
76+
Compress-Archive -Path dist/$env:RID/* -DestinationPath cge-tools-$env:RID.zip -Force
77+
78+
- name: Upload asset artifact
79+
uses: actions/upload-artifact@v4
80+
with:
81+
name: release-asset-${{ matrix.rid }}
82+
path: cge-tools-${{ matrix.rid }}.zip
83+
84+
release:
85+
name: Create GitHub Release
86+
runs-on: ubuntu-latest
87+
needs: build
88+
89+
steps:
90+
- name: Download assets
91+
uses: actions/download-artifact@v4
92+
with:
93+
path: release-assets
94+
merge-multiple: true
95+
96+
- name: Publish GitHub release
97+
uses: softprops/action-gh-release@v2
98+
with:
99+
files: release-assets/*.zip
100+
fail_on_unmatched_files: true
101+
generate_release_notes: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,3 +808,4 @@ FodyWeavers.xsd
808808

809809
# Android studio 3.1+ serialized cache file
810810

811+
dist/

0 commit comments

Comments
 (0)