generated from juliandittmann/AL.Template
-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (35 loc) · 1.7 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: Release
on:
workflow_dispatch:
defaults:
run:
shell: PowerShell
jobs:
Release_to_storage:
runs-on: windows-latest
steps:
- uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: ci.yml
workflow_conclusion: success
- name: Publish
env:
StorageConnectionString: ${{ secrets.StorageConnectionString }}
run: |
$manifest = Get-Content "Manifest\manifest.json" | ConvertFrom-Json
$appVersion = $manifest.Version
$projectName = "${{ github.event.repository.name }}".Replace('.','-').ToLowerInvariant()
$storageContext = New-AzureStorageContext -ConnectionString "${{ secrets.StorageConnectionString }}"
New-AzureStorageContainer -Name $projectName -Context $storageContext -Permission "Container" -ErrorAction Ignore | Out-Null
"RuntimePackages", "Apps", "TestApps" | % {
if (Test-Path "$_\*") {
$tempFile = Join-Path ([System.IO.Path]::Gettemppath()) "$([Guid]::newguid().ToString()).zip"
Compress-Archive -path (Get-Item $_).FullName -DestinationPath $tempFile
Write-Host "$appVersion/$_.zip".ToLowerInvariant()
Set-AzureStorageBlobContent -File $tempFile -Context $storageContext -Container $projectName -Blob "$appVersion/$_.zip".ToLowerInvariant() -Force | Out-Null
Write-Host "latest/$_.zip".ToLowerInvariant()
Set-AzureStorageBlobContent -File $tempFile -Context $storageContext -Container $projectName -Blob "latest/$_.zip".ToLowerInvariant() -Force | Out-Null
Remove-Item $tempFile -Force
}
}