Skip to content

Commit 4977fb2

Browse files
gablmCryotechnic
andcommitted
Add flows for build & release
Co-Authored-By: Ron Friedman <[email protected]>
1 parent 91709b8 commit 4977fb2

File tree

3 files changed

+187
-51
lines changed

3 files changed

+187
-51
lines changed

.github/workflows/build.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Build and Publish Plugin
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
inputs:
10+
publish_profile:
11+
description: 'Publish profile to use'
12+
required: true
13+
type: choice
14+
options:
15+
- ReleaseNoReflectionPublish-O1
16+
- ReleaseNoReflectionPublish-O2
17+
- ReleasePublish-O1
18+
- ReleasePublish-O2
19+
- DebugPublish
20+
- DebugNoReflectionPublish
21+
default: ReleaseNoReflectionPublish-O1
22+
23+
permissions:
24+
id-token: write
25+
contents: read
26+
attestations: write
27+
28+
jobs:
29+
build:
30+
runs-on: windows-latest
31+
32+
steps:
33+
- name: Checkout code
34+
uses: actions/checkout@v4
35+
with:
36+
submodules: true
37+
38+
- name: Setup .NET
39+
uses: actions/setup-dotnet@v4
40+
with:
41+
dotnet-version: '10.0.x'
42+
43+
- name: Set publish profile
44+
shell: pwsh
45+
run: |
46+
if ($env:GITHUB_EVENT_NAME -eq 'workflow_dispatch') {
47+
$profile = '${{ inputs.publish_profile }}'
48+
} else {
49+
$profile = 'ReleaseNoReflectionPublish-O1'
50+
}
51+
echo "PUBLISH_PROFILE=$profile" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
52+
53+
- name: Restore dependencies
54+
run: dotnet restore Hi3Helper.Plugin.DNA.sln
55+
56+
- name: Build solution
57+
run: dotnet build --configuration Release Hi3Helper.Plugin.DNA.sln --no-restore
58+
59+
- name: Publish with selected profile
60+
run: dotnet publish Hi3Helper.Plugin.DNA/Hi3Helper.Plugin.DNA.csproj --configuration Release --runtime win-x64 /p:PublishProfile=$PUBLISH_PROFILE -o ./publish
61+
62+
- name: Generate build provenance
63+
uses: actions/attest-build-provenance@v1
64+
with:
65+
subject-path: './publish/**'
66+
67+
- name: Upload build artifacts
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: plugin-build
71+
path: ./publish/

.github/workflows/qodana_code_quality.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Release Plugin
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Release version'
8+
required: true
9+
type: string
10+
publish_profile:
11+
description: 'Publish profile to use'
12+
required: true
13+
type: choice
14+
options:
15+
- ReleaseNoReflectionPublish-O1
16+
- ReleaseNoReflectionPublish-O2
17+
- ReleasePublish-O1
18+
- ReleasePublish-O2
19+
- DebugPublish
20+
- DebugNoReflectionPublish
21+
default: ReleaseNoReflectionPublish-O1
22+
23+
permissions:
24+
id-token: write
25+
contents: write
26+
attestations: write
27+
28+
jobs:
29+
release:
30+
runs-on: windows-latest
31+
32+
steps:
33+
- name: Checkout code
34+
uses: actions/checkout@v4
35+
with:
36+
fetch-depth: 0 # Fetch full history for changelog
37+
submodules: true
38+
39+
- name: Setup .NET
40+
uses: actions/setup-dotnet@v4
41+
with:
42+
dotnet-version: '10.0.x'
43+
44+
- name: Restore dependencies
45+
run: dotnet restore Hi3Helper.Plugin.DNA.sln
46+
47+
- name: Build solution
48+
run: dotnet build --configuration Release Hi3Helper.Plugin.DNA.sln --no-restore
49+
50+
- name: Publish with selected profile
51+
run: dotnet publish Hi3Helper.Plugin.DNA/Hi3Helper.Plugin.DNA.csproj --configuration Release --runtime win-x64 /p:PublishProfile=${{ inputs.publish_profile }} -o ./publish
52+
53+
- name: Generate build provenance
54+
uses: actions/attest-build-provenance@v1
55+
with:
56+
subject-path: './publish/**'
57+
58+
- name: Run Indexer
59+
run: .\Indexer.exe .\publish
60+
61+
- name: Generate Changelog
62+
uses: orhun/git-cliff-action@v4
63+
with:
64+
configuration: cliff.toml
65+
args: --latest --strip header
66+
id: git-cliff
67+
68+
- name: Create Release
69+
uses: softprops/action-gh-release@v2
70+
with:
71+
tag_name: v${{ inputs.version }}
72+
name: Release v${{ inputs.version }}
73+
body: ${{ steps.git-cliff.outputs.content }}
74+
files: ./publish/*.zip
75+
env:
76+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
78+
- name: Checkout target repo
79+
uses: actions/checkout@v4
80+
with:
81+
repository: CollapseLauncher/CollapseLauncher-ReleaseRepo
82+
path: ./target-repo
83+
token: ${{ secrets.RELEASE_REPO_TOKEN }}
84+
85+
- name: Copy files to target repo
86+
run: |
87+
New-Item -ItemType Directory -Force -Path ./target-repo/inhouse-plugin/duetnightabyss/build
88+
Copy-Item -Path ./publish/DNAbyss.dll -Destination ./target-repo/inhouse-plugin/duetnightabyss/
89+
Copy-Item -Path ./publish/DNAbyss.pdb -Destination ./target-repo/inhouse-plugin/duetnightabyss/
90+
Copy-Item -Path ./publish/manifest.json -Destination ./target-repo/inhouse-plugin/duetnightabyss/
91+
Copy-Item -Path ./publish/SevenZipExtractor.pdb -Destination ./target-repo/inhouse-plugin/duetnightabyss/
92+
Copy-Item -Path ./publish/Lib/7z.dll -Destination ./target-repo/inhouse-plugin/duetnightabyss/Lib/
93+
Copy-Item -Path ./publish/*.zip -Destination ./target-repo/inhouse-plugin/duetnightabyss/build/
94+
95+
- name: Create Pull Request in Release Repo
96+
uses: peter-evans/create-pull-request@v7
97+
with:
98+
token: ${{ secrets.RELEASE_REPO_TOKEN }}
99+
path: ./target-repo
100+
branch: dna-plugin-release-${{ inputs.version }}
101+
base: main
102+
title: 'Release DNA Plugin v${{ inputs.version }}'
103+
body: |
104+
Automated release of DNA Plugin v${{ inputs.version }}
105+
106+
${{ steps.git-cliff.outputs.content }}
107+
108+
Files updated:
109+
- DNAbyss.dll
110+
- DNAbyss.pdb
111+
- manifest.json
112+
- SevenZipExtractor.pdb
113+
- Lib/7z.dll
114+
- build/*.zip
115+
commit-message: 'Release DNA Plugin v${{ inputs.version }}'
116+
delete-branch: false

0 commit comments

Comments
 (0)