Bump actions/checkout from 5 to 6 (#10) #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
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| name: main | |
| jobs: | |
| build: | |
| name: Build MagickViewer | |
| runs-on: windows-2022 | |
| permissions: | |
| id-token: write | |
| outputs: | |
| has-tag: ${{ steps.check-tag.outputs.has-tag }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-tags: true | |
| - name: Check if commit has tag | |
| if: github.event_name != 'pull_request' | |
| id: check-tag | |
| run: | | |
| $tag = git tag --points-at HEAD | |
| if ($tag) { | |
| echo "Tag found: $tag" | |
| echo "has-tag=true" >> $env:GITHUB_OUTPUT | |
| } else { | |
| echo "No tag found" | |
| echo "has-tag=false" >> $env:GITHUB_OUTPUT | |
| } | |
| shell: powershell | |
| - name: Setup MSBuild | |
| uses: microsoft/setup-msbuild@v2 | |
| - name: Restore NuGet packages | |
| run: nuget restore MagickViewer/packages.config -PackagesDirectory packages | |
| - name: Build | |
| run: msbuild MagickViewer.sln /p:Configuration=Release /p:Platform="Any CPU" | |
| - name: Publish | |
| run: msbuild MagickViewer.sln /p:Configuration=Release /p:Platform="Any CPU" /p:PublishClickOnce=true /t:PublishClickOnce | |
| - name: Azure CLI login with federated credential | |
| if: github.event_name != 'pull_request' | |
| uses: azure/login@v2 | |
| with: | |
| client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
| tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
| subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
| - name: Install sign cli | |
| if: github.event_name != 'pull_request' | |
| run: dotnet tool install --global sign --prerelease | |
| - name: Sign application | |
| if: github.event_name != 'pull_request' | |
| run: sign code trusted-signing ` | |
| --trusted-signing-account ImageMagick ` | |
| --trusted-signing-certificate-profile ImageMagick ` | |
| --trusted-signing-endpoint https://eus.codesigning.azure.net ` | |
| --azure-credential-type azure-cli ` | |
| --verbosity information ` | |
| MagickViewer.application | |
| working-directory: MagickViewer/bin/Release/app.publish | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: MagickViewer | |
| path: MagickViewer\bin\Release\app.publish\** | |
| deploy: | |
| name: Deploy MagickViewer | |
| runs-on: windows-2022 | |
| needs: build | |
| if: needs.build.outputs.has-tag == 'true' | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v6 | |
| with: | |
| name: MagickViewer | |
| path: MagickViewer | |
| - name: Deploy to Azure Web App | |
| uses: azure/[email protected] | |
| with: | |
| app-name: magickviewer | |
| publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} | |
| package: MagickViewer |