Publish Website #188
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: Publish Website | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - docs | |
| paths: | |
| - src/IPFilter.Docs/**/* | |
| pull_request: | |
| types: [opened, synchronize, reopened, closed] | |
| branches: | |
| - main | |
| paths: | |
| - src/IPFilter.Docs/**/* | |
| release: | |
| types: [published, edited] | |
| workflow_run: | |
| workflows: | |
| ["Nightly Lists"] | |
| types: [completed] | |
| branches: | |
| - main | |
| jobs: | |
| build_and_deploy_job: | |
| if: github.event_name != 'pull_request' || github.event.action != 'closed' | |
| runs-on: ubuntu-latest | |
| name: Build and Deploy Job | |
| env: | |
| SITE_PATH: ${{ github.workspace }}/src/IPFilter.Docs | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| submodules: true | |
| - name: Set up .NET | |
| uses: actions/setup-dotnet@v3 | |
| id: setup-dotnet | |
| with: | |
| dotnet-version: '9.0.x' | |
| - name: Install toolchain | |
| id: setup-sitegen | |
| run: dotnet tool restore | |
| - name: Build site | |
| id: build-site | |
| run: dotnet build "${{ env.SITE_PATH }}/IPFilter.Docs.csproj" | |
| - name: Run SiteGen | |
| id: run-sitegen | |
| run: | | |
| cd "${{ env.SITE_PATH }}" | |
| dotnet run & | |
| sleep 10 | |
| dotnet sitegen | |
| - name: Build And Deploy | |
| id: builddeploy | |
| uses: Azure/static-web-apps-deploy@v1 | |
| with: | |
| azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }} | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments) | |
| action: "upload" | |
| skip_app_build: true | |
| app_location: "./src/IPFilter.Docs/public" | |
| close_pull_request_job: | |
| if: github.event_name == 'pull_request' && github.event.action == 'closed' | |
| runs-on: ubuntu-latest | |
| name: Close Pull Request Job | |
| steps: | |
| - name: Close Pull Request | |
| id: closepullrequest | |
| uses: Azure/static-web-apps-deploy@v1 | |
| with: | |
| azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }} | |
| action: "close" |