Merge pull request #525 from StefanMaron/development #358
This file contains 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
--- | |
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 |