From 27b2015c06ade4a1ec1814c90bcf456254b984dd Mon Sep 17 00:00:00 2001 From: Arthur van de Vondervoort Date: Sat, 14 Sep 2024 18:43:44 +0200 Subject: [PATCH 1/2] Add platform-artifacts action --- .github/actions/dotnet-build/action.yml | 16 +++--- .github/actions/platform-artifacts/action.yml | 51 +++++++++++++++++++ 2 files changed, 58 insertions(+), 9 deletions(-) create mode 100644 .github/actions/platform-artifacts/action.yml diff --git a/.github/actions/dotnet-build/action.yml b/.github/actions/dotnet-build/action.yml index c63210dd..310accc3 100644 --- a/.github/actions/dotnet-build/action.yml +++ b/.github/actions/dotnet-build/action.yml @@ -34,15 +34,13 @@ runs: shell: pwsh run: dotnet restore BusinessCentral.LinterCop - - name: Download platform artifact - shell: pwsh - env: - ASSET_URI: ${{ inputs.al-asset-uri }} - run: Invoke-WebRequest $env:ASSET_URI -OutFile ALLanguage.vsix - - - name: Unzip vsix - shell: pwsh - run: 7z x ALLanguage.vsix "-oALLanguage" "extension/bin/Analyzers" -r + - name: Get AL Language platform artifacts + id: get-platform-artifacts + uses: ./.github/actions/platform-artifacts + with: + version-number: ${{ inputs.al-version-number }} + asset-uri: ${{ inputs.al-asset-uri }} + target-path: ALLanguage - name: Set AssemblyInfo shell: pwsh diff --git a/.github/actions/platform-artifacts/action.yml b/.github/actions/platform-artifacts/action.yml new file mode 100644 index 00000000..89d697f2 --- /dev/null +++ b/.github/actions/platform-artifacts/action.yml @@ -0,0 +1,51 @@ +name: Download AL Language platform artifacts +description: "" + +inputs: + version-number: + required: true + description: The version number of the corresponding AL Language + asset-uri: + required: true + description: The asset uri for retrieving the VSIXPackages of the AL Language + target-path: + required: true + description: Path to store the artifacts + +runs: + using: composite + steps: + - name: Get platform artifact from cache + id: get_platform_artifact + uses: actions/cache/restore@v4 + with: + path: ${{ inputs.target-path }} + key: al-platform-artifact-${{ inputs.version-number }} + fail-on-cache-miss: false + + - name: Download platform artifact + id: download_platform_artifact + if: steps.get_platform_artifact.outputs.cache-hit != 'true' + shell: pwsh + env: + ASSET_URI: ${{ inputs.asset-uri }} + RUNNER_TEMP: ${{ runner.temp }} + run: | + $downloadFilePath = Join-Path $env:RUNNER_TEMP 'ALLanguage.vsix' + Invoke-WebRequest $env:ASSET_URI -OutFile $downloadFilePath + echo "path=$($downloadFilePath)" >> $env:GITHUB_OUTPUT + + - name: Extract platform artifact + if: steps.get_platform_artifact.outputs.cache-hit != 'true' + shell: pwsh + env: + ARCHIVE_PATH: ${{ steps.download_platform_artifact.outputs.path }} + run: 7z x $env:ARCHIVE_PATH "-o${{ inputs.target-path }}" "extension/bin/Analyzers" -r + + - name: Add platform artifact to cache + id: add_hash + if: steps.get_platform_artifact.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 + with: + path: ${{ inputs.target-path }} + key: al-platform-artifact-${{ inputs.version-number }} From dcf0be045db43b2b45ab669cc33ee9503b4e09f3 Mon Sep 17 00:00:00 2001 From: Arthur van de Vondervoort Date: Sat, 14 Sep 2024 18:44:00 +0200 Subject: [PATCH 2/2] set name --- .github/workflows/DailyCheckForUpdates.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/DailyCheckForUpdates.yml b/.github/workflows/DailyCheckForUpdates.yml index c5a22367..783eac0a 100644 --- a/.github/workflows/DailyCheckForUpdates.yml +++ b/.github/workflows/DailyCheckForUpdates.yml @@ -33,8 +33,9 @@ jobs: Write-Host "Calculated hash is: $($hashString)" echo "hash=$($hashString)" >> $env:GITHUB_OUTPUT - - uses: actions/cache/restore@v4 + - name: Get hash value from cache id: get_hash + uses: actions/cache/restore@v4 with: path: ${{ runner.temp }}/hash.txt key: al-marketplace-hash-${{ steps.generate_hash.outputs.hash }}