Testing linux x64 publish. #27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Release | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| tags: [ 'v*' ] | |
| pull_request: | |
| branches: [ main ] | |
| env: | |
| DOTNET_VERSION: '9.0.x' | |
| PROJECT_PATH: 'DazContentInstaller/DazContentInstaller.csproj' | |
| ARTIFACT_NAME: 'DazContentInstaller' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Build | |
| run: dotnet build ${{ env.PROJECT_PATH }} --configuration Release | |
| # - name: Test | |
| # run: dotnet test ${{ env.PROJECT_PATH }} --no-build --verbosity normal \ | |
| # continue-on-error: true | |
| - name: Publish for Windows x64 | |
| run: | | |
| dotnet publish ${{ env.PROJECT_PATH }} \ | |
| --configuration Release \ | |
| --runtime win-x64 \ | |
| --output "./publish/win-x64" \ | |
| --verbosity normal \ | |
| --self-contained true | |
| - name: Publish for Windows x86 | |
| run: | | |
| dotnet publish ${{ env.PROJECT_PATH }} \ | |
| --configuration Release \ | |
| --runtime win-x86 \ | |
| --output "./publish/win-x86" \ | |
| --verbosity normal \ | |
| --self-contained true | |
| - name: Publish for Linux x64 | |
| run: | | |
| dotnet publish ${{ env.PROJECT_PATH }} \ | |
| --configuration Release \ | |
| --runtime linux-x64 \ | |
| --output "./publish/linux-x64" \ | |
| --verbosity normal \ | |
| --self-contained true | |
| - name: Create zip archives | |
| run: | | |
| # Create directories for zip files | |
| mkdir -p ./artifacts | |
| # Zip x64 version | |
| cd ./publish/win-x64 && zip -r "../../artifacts/${{ env.ARTIFACT_NAME }}-win-x64.zip" . && cd ../.. | |
| # Zip x86 version | |
| cd ./publish/win-x86 && zip -r "../../artifacts/${{ env.ARTIFACT_NAME }}-win-x86.zip" . && cd ../.. | |
| # Zip linux-x64 version | |
| cd ./publish/linux-x64 && zip -r "../../artifacts/${{ env.ARTIFACT_NAME }}-linux-x64.zip" . && cd ../.. | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.ARTIFACT_NAME }}-builds | |
| path: ./artifacts/*.zip | |
| retention-days: 30 | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Publish for Windows x64 | |
| run: | | |
| dotnet publish ${{ env.PROJECT_PATH }} \ | |
| --configuration Release \ | |
| --runtime win-x64 \ | |
| --output "./publish/win-x64" \ | |
| --verbosity normal \ | |
| --self-contained true | |
| - name: Publish for Windows x86 | |
| run: | | |
| dotnet publish ${{ env.PROJECT_PATH }} \ | |
| --configuration Release \ | |
| --runtime win-x86 \ | |
| --output "./publish/win-x86" \ | |
| --verbosity normal \ | |
| --self-contained true | |
| - name: Publish for Linux x64 | |
| run: | | |
| dotnet publish ${{ env.PROJECT_PATH }} \ | |
| --configuration Release \ | |
| --runtime linux-x64 \ | |
| --output "./publish/linux-x64" \ | |
| --verbosity normal \ | |
| --self-contained true | |
| - name: Create zip archives | |
| run: | | |
| # Create directories for zip files | |
| mkdir -p ./artifacts | |
| # Zip x64 version | |
| cd ./publish/win-x64 && zip -r "../../artifacts/${{ env.ARTIFACT_NAME }}-${{ github.ref_name }}-win-x64.zip" . && cd ../.. | |
| # Zip x86 version | |
| cd ./publish/win-x86 && zip -r "../../artifacts/${{ env.ARTIFACT_NAME }}-${{ github.ref_name }}-win-x86.zip" . && cd ../.. | |
| # Zip linux-x64 version | |
| cd ./publish/linux-x64 && zip -r "../../artifacts/${{ env.ARTIFACT_NAME }}-linux-x64.zip" . && cd ../.. | |
| - name: Generate release notes | |
| id: release_notes | |
| run: | | |
| tag="${{ github.ref_name }}" | |
| cat << EOF > ./release_notes.md | |
| ## Release $tag | |
| ### Downloads | |
| - **Windows x64**: ${{ env.ARTIFACT_NAME }}-$tag-win-x64.zip | |
| - **Windows x86**: ${{ env.ARTIFACT_NAME }}-$tag-win-x86.zip | |
| - **Linux x64**: ${{ env.ARTIFACT_NAME }}-$tag-linux-x64.zip | |
| EOF | |
| echo "notes_file=./release_notes.md" >> $GITHUB_OUTPUT | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: ./artifacts/*.zip | |
| body_path: ${{ steps.release_notes.outputs.notes_file }} | |
| draft: false | |
| prerelease: ${{ contains(github.ref_name, '-') }} | |
| generate_release_notes: true |