-
Notifications
You must be signed in to change notification settings - Fork 29
122 lines (113 loc) · 5.87 KB
/
build.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
---
name: .NET
on:
push:
branches:
- master
- prerelease
workflow_dispatch: null
jobs:
build:
runs-on: windows-latest
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.*
- name: Restore dependencies
run: dotnet restore
- name: GetALVsixVersionAndURL
id: get-vsix
run: >
$listing = Invoke-WebRequest -Method POST -UseBasicParsing -Uri
https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery?api-version=3.0-preview.1
-Body
'{"filters":[{"criteria":[{"filterType":8,"value":"Microsoft.VisualStudio.Code"},{"filterType":12,"value":"4096"},{"filterType":7,"value":"ms-dynamics-smb.al"}],"pageNumber":1,"pageSize":50,"sortBy":0,"sortOrder":0}],"assetTypes":[],"flags":147}'
-ContentType application/json | ConvertFrom-Json ;
$ALVersion_Current = $listing.results.extensions.versions | where properties -ne $null | Where-Object { $_.properties.key -notcontains 'Microsoft.VisualStudio.Code.PreRelease'} | Select-Object -First 1 -ExpandProperty version;
$vsixUrl_Current = $listing.results.extensions.versions | where properties -ne $null | Where-Object { $_.properties.key -notcontains 'Microsoft.VisualStudio.Code.PreRelease'} | Select-Object -First 1 -ExpandProperty files | Where-Object { $_.assetType -eq "Microsoft.VisualStudio.Services.VSIXPackage"} | Select-Object -ExpandProperty source;
$ALVersion_Next = $listing.results.extensions.versions | where properties -ne $null | Where-Object { $_.properties.key -contains 'Microsoft.VisualStudio.Code.PreRelease'} | Select-Object -First 1 -ExpandProperty version;
$vsixUrl_Next = $listing.results.extensions.versions | where properties -ne $null | Where-Object { $_.properties.key -contains 'Microsoft.VisualStudio.Code.PreRelease'} | Select-Object -First 1 -ExpandProperty files | Where-Object { $_.assetType -eq "Microsoft.VisualStudio.Services.VSIXPackage"} | Select-Object -ExpandProperty source;
echo "AL_VERSION_CURRENT=$ALVersion_Current" >> $env:GITHUB_OUTPUT;
echo "VSIX_URL_CURRENT=$vsixUrl_Current" >> $env:GITHUB_OUTPUT;
echo "AL_VERSION_NEXT=$ALVersion_Next" >> $env:GITHUB_OUTPUT;
echo "VSIX_URL_NEXT=$vsixUrl_Next" >> $env:GITHUB_OUTPUT;
- name: Download platform artifact Current
run: Invoke-WebRequest ${{ steps.get-vsix.outputs.VSIX_URL_CURRENT }} -OutFile
ALLanguage_current.vsix
- name: Download platform artifact Next
run: Invoke-WebRequest ${{ steps.get-vsix.outputs.VSIX_URL_NEXT }} -OutFile
ALLanguage_next.vsix
- name: Unzip vsix current
run: 7z x "ALLanguage_current.vsix" "-oms-dynamics-smb.al-latest"
extension\bin\Analyzers -r
- name: Release
id: create_release
uses: release-drafter/release-drafter@v5
with:
prerelease: ${{ github.ref != 'refs/heads/master' }}
commitish: ${{ github.ref }}
disable-autolabeler: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set current version
run: (Get-Content AssemblyInfo.cs) -replace 'Version\("([\d\.]+)"\)]',
("Version(""" + ('${{ steps.create_release.outputs.tag_name }}'
-replace "v","") + """)]") | Out-File AssemblyInfo.cs
- name: Build current
run: dotnet build --no-restore --configuration Release
- name: Upload a Build current
uses: actions/[email protected]
with:
name: BusinessCentral.LinterCop.current.dll
path: bin/Release/netstandard2.1/BusinessCentral.LinterCop.dll
- name: Remove a Release Asset current
uses: flcdrg/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ steps.create_release.outputs.id }}
asset_name: BusinessCentral.LinterCop.current.dll
- name: Upload Release Asset current
id: upload-release-asset-current
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: bin/Release/netstandard2.1/BusinessCentral.LinterCop.dll
asset_name: BusinessCentral.LinterCop.current.dll
asset_content_type: application/octet-stream
- name: Clear Build output
run: Remove-Item -Path "bin/Release" -Force -Recurse -Verbose;
- name: Unzip vsix next
run: >
Remove-Item -Path "ms-dynamics-smb.al-latest" -Force -Recurse -Verbose;
7z x "ALLanguage_next.vsix" "-oms-dynamics-smb.al-latest" extension\bin\Analyzers -r;
- name: Build next
run: dotnet build --no-restore --configuration Release
- name: Upload a Build next
uses: actions/[email protected]
with:
name: BusinessCentral.LinterCop.next.dll
path: bin/Release/netstandard2.1/BusinessCentral.LinterCop.dll
- name: Remove a Release Asset next
uses: flcdrg/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ steps.create_release.outputs.id }}
asset_name: BusinessCentral.LinterCop.next.dll
- name: Upload Release Asset next
id: upload-release-asset-next
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: bin/Release/netstandard2.1/BusinessCentral.LinterCop.dll
asset_name: BusinessCentral.LinterCop.next.dll
asset_content_type: application/octet-stream