From 16afa1a1aeb25314ecdea3f94c4053a1a6f42482 Mon Sep 17 00:00:00 2001 From: leceta Date: Wed, 7 Aug 2024 17:41:46 +0200 Subject: [PATCH] Deploy to Yak job added --- .github/workflows/grasshopper_plugin.yml | 73 +++++++++++++++++++++++- 1 file changed, 70 insertions(+), 3 deletions(-) diff --git a/.github/workflows/grasshopper_plugin.yml b/.github/workflows/grasshopper_plugin.yml index 2ed8dee..e5de85b 100644 --- a/.github/workflows/grasshopper_plugin.yml +++ b/.github/workflows/grasshopper_plugin.yml @@ -1,4 +1,4 @@ -name: Grasshopper Plugin Build +name: "Grasshopper Plugin Build & Deploy to Yak" on: push: @@ -6,10 +6,11 @@ on: - main tags: - '*' - + jobs: build: runs-on: [ windows-2019 ] + if: startsWith(github.ref, 'refs/tags/') steps: - name: Checkout Repo uses: actions/checkout@v3 @@ -21,7 +22,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: Tapir Grasshopper Plugin - path: grasshopper-plugin/bin/tapir_gh.ghpy + path: grasshopper-plugin/bin/tapir_gh.ghpy - name: Create Release if: startsWith(github.ref, 'refs/tags/') uses: ncipollo/release-action@v1 @@ -30,3 +31,69 @@ jobs: draft: true allowUpdates: true token: ${{ secrets.GITHUB_TOKEN }} + + deploy: + runs-on: windows-latest + environment: tapir + needs: build + if: startsWith(github.ref, 'refs/tags/') + + steps: + - name: checkout + uses: actions/checkout@v3.2.0 + + - name: setup yak + uses: paramdigma/setup-yak@1.0.0 + with: + token: ${{secrets.YAK_TOKEN}} + + - name: Download Artifact + uses: actions/download-artifact@v3 + with: + name: Tapir Grasshopper Plugin + path: grasshopper-plugin/bin + + - name: Copy Image to Destination + run: | + Copy-Item -Path "../../branding/logo/png/tapir_logo_black_512.png" -Destination "./tapir_logo_black_512.png" + working-directory: grasshopper-plugin\bin + shell: pwsh + + - name: Create Yak manifest + run: | + yak spec + Add-Content manifest.yml "icon: tapir_logo_black_512.png" + (Get-Content -Path "./manifest.yml") -replace '', '${{ github.ref_name }}' | Set-Content -Path "./manifest.yml" + (Get-Content -Path "./manifest.yml") -replace '', 'Tapir' | Set-Content -Path "./manifest.yml" + (Get-Content -Path "./manifest.yml") -replace '', 'Tapir Community' | Set-Content -Path "./manifest.yml" + (Get-Content -Path "./manifest.yml") -replace '', 'A toolset for Archicad automatization.' | Set-Content -Path "./manifest.yml" + (Get-Content -Path "./manifest.yml") -replace '', '"https://www.archicad-api.com/"' | Set-Content -Path "./manifest.yml" + working-directory: grasshopper-plugin\bin + + - name: Print YAML File Content + run: | + Get-Content -Path "grasshopper-plugin/bin/manifest.yml" -Raw + shell: pwsh + + - name: Build YAK package + run: yak build + working-directory: grasshopper-plugin\bin + + - name: Find yak file + run: | + Get-ChildItem -Path . + $yakFile = Get-ChildItem -Path . *.yak -Recurse | Select-Object -First 1 + if ($yakFile -eq $null) { + Write-Error "No .yak file found." + exit 1 + } + $env:YAK_FILE = $yakFile.FullName + echo "YAK_FILE=$env:YAK_FILE" >> $env:GITHUB_ENV + working-directory: grasshopper-plugin\bin + + - name: deploy to yak server + run: | + yak push $env:YAK_FILE + #yak push --source https://test.yak.rhino3d.com $env:YAK_FILE + env: + YAK_TOKEN: ${{ secrets.YAK_TOKEN }}