diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cabf07f..c32c7bf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,25 +32,4 @@ jobs: with: name: DrumMidiRemapper-${{ matrix.runtime }} path: ./publish/${{ matrix.runtime }} - - release: - needs: build - runs-on: ubuntu-latest - if: github.ref == 'refs/heads/main' - steps: - - name: Download all artifacts - uses: actions/download-artifact@v4 - with: - path: ./artifacts - - - name: Create GitHub Release - id: create_release - uses: softprops/action-gh-release@v2 - with: - tag_name: ${{ github.sha }} - name: Release ${{ github.sha }} - draft: false - prerelease: false - files: ./artifacts/**/* - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + \ No newline at end of file diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml new file mode 100644 index 0000000..4f55358 --- /dev/null +++ b/.github/workflows/pr-validation.yml @@ -0,0 +1,40 @@ +name: PR Validation + +on: + pull_request: + +jobs: + build-and-validate: + name: Build, Test & Validate + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '9.0.x' + + - name: Restore dependencies + run: dotnet restore + + - name: Check code formatting + run: dotnet format --verify-no-changes + + - name: Build with analyzers + run: dotnet build --configuration Release -warnaserror + + - name: Run unit tests + run: dotnet test --no-build --verbosity normal + + - name: Validate mapping JSON files + run: | + for file in $(find ./Services/Resources/Maps -name "*.json"); do + echo "Validating $file" + jq empty "$file" + done + + - name: Check for vulnerable packages + run: dotnet list package --vulnerable \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..cbd3ad9 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,58 @@ +name: Release + +on: + push: + tags: + - 'v*' + +jobs: + build-and-release: + name: Build and Release Binaries + + strategy: + matrix: + include: + - os: windows-latest + rid: win-x64 + ext: .exe + - os: macos-latest + rid: osx-x64 + ext: '' + - os: macos-latest + rid: osx-arm64 + ext: '' + - os: ubuntu-latest + rid: linux-x64 + ext: '' + + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '9.0.x' + + - name: Publish single-file binary + run: | + dotnet publish src/CLI \ + -c Release \ + -r ${{ matrix.rid }} \ + --self-contained true \ + /p:PublishSingleFile=true \ + /p:IncludeAllContentForSelfExtract=true \ + -o publish + + - name: Rename binary + run: | + mv publish/CLI${{ matrix.ext }} publish/DrumMidiRemapper-${{ matrix.rid }}${{ matrix.ext }} + + - name: Upload Release Asset + uses: softprops/action-gh-release@v2 + with: + files: publish/DrumMidiRemapper-${{ matrix.rid }}${{ matrix.ext }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file