From 3f7749ae66065eabfe254f3d54dc435d3fe49224 Mon Sep 17 00:00:00 2001 From: Rick <1450685+LinuxSuRen@users.noreply.github.com> Date: Thu, 16 May 2024 09:38:30 +0800 Subject: [PATCH] fix: using powershell on windows (#434) Co-authored-by: rick --- .github/workflows/release.yaml | 36 ++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index fd00b8e..aebdc5d 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -138,7 +138,7 @@ jobs: - name: Upload to Draft env: GITHUB_TOKEN: ${{ secrets.GH_PUBLISH_SECRETS }} - if: github.ref == 'refs/heads/master' + if: github.ref == 'refs/heads/master' && runner.os != 'Windows' run: | cd console/atest-desktop export TAG=$(gh release list -L 1 | awk '{print $4}') @@ -146,10 +146,26 @@ jobs: jq '.version = env.TAG' package.json > package.json.new && mv package.json.new package.json npm i npm run publish + - name: Upload to Draft on Windows + env: + GITHUB_TOKEN: ${{ secrets.GH_PUBLISH_SECRETS }} + if: github.ref == 'refs/heads/master' && runner.os == 'Windows' + run: | + cd console/atest-desktop + $TAG = (gh release list -L 1).Split(' ')[0] + if ($TAG -like "v*") { + $TAG = $TAG -replace "^v", "" + } + Set-Content -Path "env:TAG" -Value "$TAG" + jq '.version = env.TAG' package.json > package.json.new + rm package.json + Rename-Item -Path package.json.new -NewName package.json + npm i + npm run publish - name: Upload env: GITHUB_TOKEN: ${{ secrets.GH_PUBLISH_SECRETS }} - if: github.ref != 'refs/heads/master' + if: github.ref != 'refs/heads/master' && runner.os != 'Windows' run: | cd console/atest-desktop export TAG=$(git describe --tags --abbrev=0) @@ -157,6 +173,22 @@ jobs: jq '.version = env.TAG' package.json > package.json.new && mv package.json.new package.json npm i npm run publish + - name: Upload on Windows + env: + GITHUB_TOKEN: ${{ secrets.GH_PUBLISH_SECRETS }} + if: github.ref != 'refs/heads/master' && runner.os == 'Windows' + run: | + cd console/atest-desktop + $TAG = git describe --tags --abbrev=0 + if ($TAG -like "v*") { + $TAG = $TAG -replace "^v", "" + } + Set-Content -Path "env:TAG" -Value "$TAG" + jq '.version = env.TAG' package.json > package.json.new + rm package.json + Rename-Item -Path package.json.new -NewName package.json + npm i + npm run publish # image-operator: # runs-on: ubuntu-20.04