diff --git a/.github/workflows/dotnet-desktop.yml b/.github/workflows/dotnet-desktop.yml index 5e31159..a8f4d43 100644 --- a/.github/workflows/dotnet-desktop.yml +++ b/.github/workflows/dotnet-desktop.yml @@ -1,4 +1,5 @@ name: Build and Release ChatAAC + on: push: branches: @@ -6,6 +7,7 @@ on: pull_request: branches: - main + jobs: build: runs-on: ${{ matrix.os }} @@ -19,35 +21,59 @@ jobs: rid: osx-x64 - os: windows-latest rid: win-x64 + steps: - name: Checkout repository uses: actions/checkout@v3 + - name: Setup .NET uses: actions/setup-dotnet@v3 with: dotnet-version: '8.0.x' + + - name: Check .NET version + run: dotnet --version + - name: Restore dependencies run: dotnet restore - - name: Build self-contained app - run: dotnet publish --configuration Release -r ${{ matrix.rid }} --self-contained -p:PublishSingleFile=true -p:PublishTrimmed=true - - name: List files in publish directory - run: ls -R bin/Release/net8.0/${{ matrix.rid }}/publish/ + + - name: Build project + run: dotnet build --configuration Release + + - name: Publish self-contained app + run: dotnet publish --configuration Release -r ${{ matrix.rid }} --self-contained -o ./publish + + - name: List contents of publish directory + run: | + if [ "${{ runner.os }}" == "Windows" ]; then + dir publish + else + ls -R publish + fi + - name: Upload artifact uses: actions/upload-artifact@v3 with: name: ChatAAC-${{ matrix.os }} - path: bin/Release/net8.0/${{ matrix.rid }}/publish/ + path: publish/ release: needs: build runs-on: ubuntu-latest + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + steps: - name: Checkout repository uses: actions/checkout@v3 + - name: Download all artifacts uses: actions/download-artifact@v3 + with: + path: artifacts + - name: Display structure of downloaded files - run: ls -R + run: ls -R artifacts + - name: Create Release id: create_release uses: actions/create-release@v1 @@ -64,30 +90,33 @@ jobs: - [macOS](https://github.com/${{ github.repository }}/releases/download/v1.0.${{ github.run_number }}/ChatAAC-macos-x64) draft: false prerelease: false + - name: Upload Release Asset (Linux) uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./bin/Release/net8.0/linux-x64/publish/ChatAAC + asset_path: ./artifacts/ChatAAC-ubuntu-latest/ChatAAC asset_name: ChatAAC-linux-x64 asset_content_type: application/octet-stream + - name: Upload Release Asset (Windows) uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./bin/Release/net8.0/win-x64/publish/ChatAAC.exe + asset_path: ./artifacts/ChatAAC-windows-latest/ChatAAC.exe asset_name: ChatAAC-windows-x64.exe asset_content_type: application/octet-stream + - name: Upload Release Asset (macOS) uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./bin/Release/net8.0/osx-x64/publish/ChatAAC + asset_path: ./artifacts/ChatAAC-macos-latest/ChatAAC asset_name: ChatAAC-macos-x64 asset_content_type: application/octet-stream