diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml new file mode 100644 index 0000000..37cfc99 --- /dev/null +++ b/.github/workflows/build-and-release.yml @@ -0,0 +1,53 @@ +name: Build and Publish Artifacts + +on: + push: + branches: [ main ] + tags: + - 'v*' + +permissions: + contents: write + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + runtime: [win-x64, osx-x64, osx-arm64, linux-x64] + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup .NET 9 SDK + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '9.0.x' + + - name: Restore dependencies + run: dotnet restore + + - name: Publish single-file executable for ${{ matrix.runtime }} + run: | + dotnet publish src/CLI \ + -c Release \ + -r ${{ matrix.runtime }} \ + --self-contained true \ + /p:PublishSingleFile=true \ + /p:IncludeAllContentForSelfExtract=true \ + -o ./publish/${{ matrix.runtime }} + + - name: Upload artifact for ${{ matrix.runtime }} + uses: actions/upload-artifact@v4 + with: + name: DrumMidiRemapper-${{ matrix.runtime }} + path: ./publish/${{ matrix.runtime }} + + - name: Upload Release Asset + if: startsWith(github.ref, 'refs/tags/v') + uses: softprops/action-gh-release@v2 + with: + files: ./publish/${{ matrix.runtime }}/CLI* + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index c32c7bf..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Build and Publish Artifacts - -on: - push: - branches: [ main ] - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - runtime: [win-x64, osx-x64, osx-arm64, linux-x64] - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Setup .NET 9 SDK - uses: actions/setup-dotnet@v3 - with: - dotnet-version: '9.0.x' - - - name: Restore dependencies - run: dotnet restore - - - name: Publish single-file executable for ${{ matrix.runtime }} - run: | - dotnet publish src/CLI -c Release -r ${{ matrix.runtime }} --self-contained true /p:PublishSingleFile=true /p:IncludeAllContentForSelfExtract=true -o ./publish/${{ matrix.runtime }} - - - name: Upload artifact for ${{ matrix.runtime }} - uses: actions/upload-artifact@v4 - with: - name: DrumMidiRemapper-${{ matrix.runtime }} - path: ./publish/${{ matrix.runtime }} - \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index cbd3ad9..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,58 +0,0 @@ -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