Skip to content

Try to make archive retrival work #210

Try to make archive retrival work

Try to make archive retrival work #210

Workflow file for this run

name: Azure Static Web Apps CI/CD
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- main
jobs:
build_only:
if: (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Publish Frontend
run: dotnet publish -c Release ./src/CZ.Azure.FileExchange/ -o temp/frontend
- name: Publish API
run: dotnet publish -c Release ./src/CZ.Azure.FileExchange.Api/ -o temp/api --runtime win-x86 --no-self-contained
- name: zip outputs
shell: pwsh
run: |
Compress-Archive temp/frontend/wwwroot/** temp/frontend.zip;
Compress-Archive temp/api/** temp/api.zip;
Remove-Item -Recurse -Force temp/frontend
Remove-Item -Recurse -Force temp/api
- name: Add Artifact App
uses: actions/upload-artifact@v3
with:
name: artifact
path: temp/
- name: Add Artifact script
uses: actions/upload-artifact@v3
with:
name: artifact
path: ./build/deploy.ps1
deploy_job:
if: (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
needs:
- build_only
environment: 'Azure Infra'
permissions:
contents: read
pages: write
id-token: write
pull-requests: write
name: Deploy Job
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: compile bicep
uses: Azure/[email protected]
with:
bicepFilePath: pr.bicep
outputFilePath: pr.json
- name: Login to Azure
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
enable-AzPSSession: true
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v2
- name: "Deploy ARM template to Azure"
uses: Azure/arm-deploy@v1
with:
scope: resourcegroup
subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
resourceGroupName: 'pajetestfileshare2'
region: 'West Europe'
template: 'pr.json'
parameters: name=pajetestfileshare2 githubToken=${{env.ACTIONS_RUNTIME_TOKEN}} branch=${{github.head_ref}} runId=${{github.run_id}} prNumber=${{github.event.number}} githubRuntimeApiUrl=${{env.ACTIONS_RUNTIME_URL}}
deploymentMode: 'Incremental'
- name: Get Website url
uses: Azure/powershell@v1
id: websiteUrl
with:
azPSVersion: 10.1.0
inlineScript: |
$hostname = (Get-AzStaticWebAppBuild -Name pajetestfileshare2 -ResourceGroupName pajetestfileshare2 -EnvironmentName ${{github.event.number}}).Hostname
"hostname=https://$hostname" >> $env:GITHUB_OUTPUT
- name: comment-pr
uses: JoseThen/[email protected]
with:
comment: Your website can be viewed here '${{ steps.websiteUrl.outputs.hostname }}'
# Github Token for authentication
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
close_pull_request_job:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close Pull Request Job
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Get PR title
id: Pr-Title
run: |
title=$(gh pr view ${{ github.event.number }} --repo ${{ github.repository }} | head -n 1)
echo "::set-output name=pr-title::$(echo $title)"
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
- name: Deploy
run: './build/deploy.ps1 -Token ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_KINDDUNE004C2C103 }} -appBuildOutput ./temp/frontend/wwwroot/ -apiBuildOutput ./temp/api/ -envrionmentName ${{ github.event.number }} -pullrequestTitle "${{steps.Pr-Title.outputs.pr-title}}" -branchName ${{ github.head_ref }} -apiFramework "dotnetisolated" -apiFrameworkVersion "7.0" -Verbose -Delete'
shell: pwsh