From c921494eaa4a6594eabb18c3e4314fed91f0911e Mon Sep 17 00:00:00 2001 From: Dennis Ameling Date: Sat, 14 Sep 2024 11:57:56 +0200 Subject: [PATCH] TO-DROP: allow running on fork --- .github/workflows/ci-artifacts.yml | 48 +++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-artifacts.yml b/.github/workflows/ci-artifacts.yml index 79076c75655..643b4837d88 100644 --- a/.github/workflows/ci-artifacts.yml +++ b/.github/workflows/ci-artifacts.yml @@ -3,7 +3,7 @@ name: ci-artifacts on: push: branches: - - main + - add-ci-artifacts pull_request: # For the continuous `ci-artifacts` release @@ -13,11 +13,31 @@ permissions: env: LC_CTYPE: C.UTF-8 +# GitHub Actions runners already default to `pwsh`, +# but because the hosted image doesn't include it yet, +# we have to manually install it. Let's also set it as +# default here so that we don't have to set it over and +# over again. +defaults: + run: + shell: pwsh + jobs: minimal-sdk-artifact: - if: github.event.repository.fork == false - runs-on: [Windows, ARM64] + # if: github.event.repository.fork == false + runs-on: dennis-windows-arm64 steps: + - name: TO-DROP Install build dependencies + shell: powershell + run: | + # Download the script to a local path + Invoke-WebRequest -Uri "https://raw.githubusercontent.com/dennisameling-org/git-for-windows-automation/github-hosted-runners/azure-self-hosted-runners/post-deployment-script.ps1" -OutFile "$env:TEMP\post-deployment-script.ps1" + + # Set PowerShell execution policy to unrestricted for the current session + Set-ExecutionPolicy -Scope Process -ExecutionPolicy Unrestricted + + # Run the script + & "$env:TEMP\post-deployment-script.ps1" - name: clone git-sdk-arm64 run: | git init --bare git-sdk-arm64.git && @@ -42,7 +62,8 @@ jobs: name: minimal-sdk path: git-sdk-aarch64-minimal.tar.gz - name: create zip and 7z SFX variants of the minimal SDK - if: github.event_name == 'push' && github.ref == 'refs/heads/main' + # if: github.event_name == 'push' && github.ref == 'refs/heads/main' + if: github.event_name == 'push' && github.ref == 'refs/heads/add-ci-artifacts' shell: bash run: | for path in clangarm64/bin/7z.exe clangarm64/bin/7z.dll clangarm64/lib/7zip/7zCon.sfx @@ -54,15 +75,27 @@ jobs: (cd minimal-sdk && ../7z.exe a -t7z -mmt=on -m0=lzma -mqs -mlc=8 -mx=9 -md=256M -mfb=273 -ms=256M -sfx../7zCon.sfx \ ../minimal-sdk-extra/git-sdk-aarch64-minimal.7z.exe * .?*) - name: upload minimal-sdk-extra artifacts - if: github.event_name == 'push' && github.ref == 'refs/heads/main' + # if: github.event_name == 'push' && github.ref == 'refs/heads/main' + if: github.event_name == 'push' && github.ref == 'refs/heads/add-ci-artifacts' uses: actions/upload-artifact@v4 with: name: minimal-sdk-extra path: minimal-sdk-extra assorted-validations: - runs-on: [Windows, ARM64] + runs-on: dennis-windows-arm64 needs: [minimal-sdk-artifact] steps: + - name: TO-DROP Install build dependencies + shell: powershell + run: | + # Download the script to a local path + Invoke-WebRequest -Uri "https://raw.githubusercontent.com/dennisameling-org/git-for-windows-automation/github-hosted-runners/azure-self-hosted-runners/post-deployment-script.ps1" -OutFile "$env:TEMP\post-deployment-script.ps1" + + # Set PowerShell execution policy to unrestricted for the current session + Set-ExecutionPolicy -Scope Process -ExecutionPolicy Unrestricted + + # Run the script + & "$env:TEMP\post-deployment-script.ps1" - name: download minimal-sdk artifact uses: actions/download-artifact@v4 with: @@ -111,7 +144,8 @@ jobs: test "grep is /usr/bin/grep" = "$(type grep)" || exit 1 grep README unzip-test.out publish-release-assets: - if: github.event_name == 'push' && github.ref == 'refs/heads/main' + # if: github.event_name == 'push' && github.ref == 'refs/heads/main' + if: github.event_name == 'push' && github.ref == 'refs/heads/add-ci-artifacts' runs-on: ubuntu-latest needs: [assorted-validations] steps: