Skip to content

Commit a5cee8d

Browse files
authored
Add Workflows (#1)
* Add Release Workflow * Add PR Validation * Update PR Validation * Update PR Validation
1 parent 7e6fd9f commit a5cee8d

File tree

3 files changed

+99
-22
lines changed

3 files changed

+99
-22
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,4 @@ jobs:
3232
with:
3333
name: DrumMidiRemapper-${{ matrix.runtime }}
3434
path: ./publish/${{ matrix.runtime }}
35-
36-
release:
37-
needs: build
38-
runs-on: ubuntu-latest
39-
if: github.ref == 'refs/heads/main'
40-
steps:
41-
- name: Download all artifacts
42-
uses: actions/download-artifact@v4
43-
with:
44-
path: ./artifacts
45-
46-
- name: Create GitHub Release
47-
id: create_release
48-
uses: softprops/action-gh-release@v2
49-
with:
50-
tag_name: ${{ github.sha }}
51-
name: Release ${{ github.sha }}
52-
draft: false
53-
prerelease: false
54-
files: ./artifacts/**/*
55-
env:
56-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: PR Validation
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
build-and-validate:
8+
name: Build, Test & Validate
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
15+
- name: Setup .NET
16+
uses: actions/setup-dotnet@v4
17+
with:
18+
dotnet-version: '9.0.x'
19+
20+
- name: Restore dependencies
21+
run: dotnet restore
22+
23+
- name: Check code formatting
24+
run: dotnet format --verify-no-changes
25+
26+
- name: Build with analyzers
27+
run: dotnet build --configuration Release -warnaserror
28+
29+
- name: Run unit tests
30+
run: dotnet test --no-build --verbosity normal
31+
32+
- name: Validate mapping JSON files
33+
run: |
34+
for file in $(find ./Services/Resources/Maps -name "*.json"); do
35+
echo "Validating $file"
36+
jq empty "$file"
37+
done
38+
39+
- name: Check for vulnerable packages
40+
run: dotnet list package --vulnerable

.github/workflows/release.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
build-and-release:
10+
name: Build and Release Binaries
11+
12+
strategy:
13+
matrix:
14+
include:
15+
- os: windows-latest
16+
rid: win-x64
17+
ext: .exe
18+
- os: macos-latest
19+
rid: osx-x64
20+
ext: ''
21+
- os: macos-latest
22+
rid: osx-arm64
23+
ext: ''
24+
- os: ubuntu-latest
25+
rid: linux-x64
26+
ext: ''
27+
28+
runs-on: ${{ matrix.os }}
29+
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v4
33+
34+
- name: Setup .NET
35+
uses: actions/setup-dotnet@v4
36+
with:
37+
dotnet-version: '9.0.x'
38+
39+
- name: Publish single-file binary
40+
run: |
41+
dotnet publish src/CLI \
42+
-c Release \
43+
-r ${{ matrix.rid }} \
44+
--self-contained true \
45+
/p:PublishSingleFile=true \
46+
/p:IncludeAllContentForSelfExtract=true \
47+
-o publish
48+
49+
- name: Rename binary
50+
run: |
51+
mv publish/CLI${{ matrix.ext }} publish/DrumMidiRemapper-${{ matrix.rid }}${{ matrix.ext }}
52+
53+
- name: Upload Release Asset
54+
uses: softprops/action-gh-release@v2
55+
with:
56+
files: publish/DrumMidiRemapper-${{ matrix.rid }}${{ matrix.ext }}
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)