Skip to content

Commit 8569007

Browse files
committed
chore(version): Add sync service release workflows and versioning
1 parent 181538e commit 8569007

2 files changed

Lines changed: 134 additions & 0 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# name-template: 'v$RESOLVED_VERSION'
2+
tag-template: 'SyncService_v$RESOLVED_VERSION'
3+
tag-prefix: 'SyncService_'
4+
commitish: refs/heads/main
5+
version-resolver:
6+
major:
7+
labels:
8+
- 'major'
9+
minor:
10+
labels:
11+
- 'minor'
12+
patch:
13+
labels:
14+
- 'patch'
15+
default: patch
16+
categories:
17+
- title: '🚀 Features'
18+
labels:
19+
- 'feature'
20+
- 'enhancement'
21+
- title: '🐛 Bug Fixes'
22+
labels:
23+
- 'fix'
24+
- 'bugfix'
25+
- 'bug'
26+
- title: '🧰 Maintenance'
27+
label: 'chore'
28+
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
29+
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
30+
template: |
31+
## Changes
32+
33+
$CHANGES
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Sync Service Build and Release
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_run:
6+
branches: [ "main" ]
7+
workflows: ["SDK Build and Release"]
8+
types:
9+
- completed
10+
11+
push:
12+
branches: [ "main" ]
13+
paths:
14+
- 'KepwareSync.Service/**'
15+
# - '.github/workflows/syncservice-build.yml'
16+
- '!**/*.md' # Exclude markdown files
17+
pull_request:
18+
branches: [ "main" ]
19+
paths:
20+
- 'KepwareSync.Service/**'
21+
# - '.github/workflows/syncservice-build.yml'
22+
- '!**/*.md' # Exclude markdown files
23+
24+
jobs:
25+
draft-release:
26+
runs-on: ubuntu-latest
27+
env:
28+
PRODUCT: Kepware Sync Service
29+
outputs:
30+
tag_name: ${{ steps.drafter.outputs.tag_name }}
31+
version: ${{ steps.nbgv.outputs.SemVer2 }}
32+
steps:
33+
- uses: actions/checkout@v4
34+
with:
35+
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
36+
- uses: dotnet/nbgv@master
37+
id: nbgv
38+
with:
39+
path: ./KepwareSync.Service
40+
setAllVars: true
41+
- name: Use Release Drafter
42+
if: ${{ github.event_name != 'pull_request'}}
43+
id: drafter
44+
uses: release-drafter/release-drafter@v6.1.0
45+
with:
46+
config-name: syncservice-release-drafter.yml
47+
version: ${{ steps.nbgv.outputs.SemVer2 }}
48+
name: ${{ env.PRODUCT }} v${{ steps.nbgv.outputs.SemVer2 }}
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
build:
52+
strategy:
53+
matrix:
54+
platform: [windows, ubuntu]
55+
runs-on: ${{ matrix.platform }}-latest
56+
permissions:
57+
contents: write
58+
pull-requests: write
59+
packages: write
60+
actions: read
61+
checks: write
62+
needs: draft-release
63+
env:
64+
tag_name: ${{ needs.draft-release.outputs.tag_name }}
65+
version: ${{ needs.draft-release.outputs.version }}
66+
steps:
67+
- uses: actions/checkout@v4
68+
with:
69+
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
70+
- name: Setup .NET
71+
uses: actions/setup-dotnet@v4
72+
with:
73+
dotnet-version: 9.0.x
74+
- name: Restore dependencies
75+
run: dotnet restore
76+
- name: Build
77+
run: dotnet build ./KepwareSync.Service/Kepware.SyncService.csproj --no-restore --configuration release
78+
- name: dotnet publish
79+
run: dotnet publish ./KepwareSync.Service/Kepware.SyncService.csproj --configuration release -o publish /p:UseAppHost=true
80+
- name: Create and Upload Release Asset (Linux)
81+
if: ${{ github.event_name != 'pull_request' && matrix.platform == 'ubuntu' }}
82+
run: |
83+
# Create the ZIP file with only the required files
84+
zip -j Kepware.SyncService-${{ env.version }}-linux-x64.zip \
85+
$(find . -path '**/publish/Kepware.SyncService') \
86+
$(find . -path '**/publish/Kepware.SyncService.dbg') \
87+
$(find . -path '**/publish/appsettings.json')
88+
# Upload the ZIP file
89+
gh release upload ${{env.tag_name}} Kepware.SyncService-${{ env.version }}-linux-x64.zip --clobber
90+
env:
91+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
92+
93+
- name: Create and Upload Release Asset (Windows)
94+
if: ${{ github.event_name != 'pull_request' && matrix.platform == 'windows' }}
95+
run: |
96+
# Create the ZIP file with only the required files
97+
Compress-Archive -Path @(".\publish\Kepware.SyncService.exe",".\publish\Kepware.SyncService.pdb", ".\publish\appsettings.json") -DestinationPath Kepware.SyncService-${{ env.version }}-win-x64.zip
98+
# Upload the ZIP file
99+
gh release upload ${{env.tag_name}} Kepware.SyncService-${{ env.version }}-win-x64.zip --clobber
100+
env:
101+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)