Skip to content

Try to make archive retrival work #179

Try to make archive retrival work

Try to make archive retrival work #179

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_and_deploy_job:
if: (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: windows-latest
environment: 'Azure Infra'
permissions:
contents: read
pages: write
id-token: write
name: Build and Deploy 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: Setup .NET Core SDK
uses: actions/[email protected]
with:
# Optional SDK version(s) to use. If not provided, will install global.json version when available. Examples: 2.2.104, 3.1, 3.1.x
dotnet-version: |
7.0.x
6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build -c Release --no-restore
- 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
- name: Deploy
id: deploy
run: './build/deploy.ps1 -Token ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_KINDDUNE004C2C103 }} -appBuildOutput ./temp/frontend.zip -apiBuildOutput ./temp/api.zip -workingDir $pwd -envrionmentName ${{ github.event.number }} -pullrequestTitle "${{steps.Pr-Title.outputs.pr-title}}" -branchName ${{ github.head_ref }} -apiFramework "dotnetisolated" -apiFrameworkVersion "7.0" -Verbose'
shell: pwsh
- name: compile bicep
uses: Azure/[email protected]
with:
bicepFilePath: deployEvent.bicep
outputFilePath: eventazuredeploy.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: "Deploy ARM template to Azure"
uses: Azure/arm-deploy@v1
with:
scope: resourcegroup
subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
resourceGroupName: 'pajetestfileshare'
region: 'West Europe'
template: 'eventazuredeploy.json'
parameters: baseUrl=${{ steps.deploy.outputs.SiteUrl }} prNumber=${{github.event.number}}
deploymentMode: 'Incremental'
- name: comment-pr
uses: JoseThen/[email protected]
with:
comment: Your website can be viewed here '${{ steps.deploy.outputs.SiteUrl }}'
# 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