Build and Deploy #29
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 Deploy | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version' | |
| required: true | |
| nuget: | |
| description: 'Push to Nuget' | |
| required: true | |
| type: boolean | |
| gh_pages: | |
| description: 'Deploy to GitHub Pages' | |
| required: true | |
| type: boolean | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/[email protected] | |
| - name: Setup .NET | |
| uses: actions/[email protected] | |
| with: | |
| dotnet-version: 10.0.x | |
| dotnet-quality: preview | |
| - name: Install Workload | |
| run: dotnet workload install wasm-tools | |
| - name: Build for Desktop | |
| run: dotnet pack sizoscopeX.Desktop -c Release -o packages /p:Version=${{ github.event.inputs.version }} | |
| - name: Push to Nuget | |
| if: ${{ github.event.inputs.nuget == 'true' }} | |
| run: dotnet nuget push ./packages/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_API_KEY }} | |
| - name: Build for Browser | |
| run: dotnet publish sizoscopeX.Browser -c Release -r browser-wasm /p:Version=${{ github.event.inputs.version }} | |
| - name: Fix Permissions | |
| run: | | |
| chmod -v -R +rX "./sizoscopeX.Browser/bin/Release/net10.0-browser/browser-wasm/publish/" | while read line; do | |
| echo "::warning title=Invalid file permissions automatically fixed::$line" | |
| done | |
| - name: Upload Browser app | |
| uses: actions/[email protected] | |
| with: | |
| path: './sizoscopeX.Browser/bin/Release/net10.0-browser/browser-wasm/publish' | |
| deploy: | |
| needs: build | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| permissions: | |
| pages: write | |
| id-token: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| if: ${{ github.event.inputs.gh_pages == 'true' }} | |
| uses: actions/[email protected] | |