将变量分配给Github操作变量中的变量



我是yaml&Github&操作,并试图找出如何分配x=y与x=值。这可能吗?在下面的例子中,我试图将CertificatePath作为一个全局变量分配给几个目录的串联。

env:
Solution_Name: WpfApp3.sln 
Test_Project_Path: TestProject1TestProject1.csproj
Wap_Project_Directory: WapProjTemplate1
Wap_Project_Path: WapProjTemplate1WapProjTemplate1.wapproj
SigningCertificate: GitHubActionsDemo.pfx
- name: SetCertPath
run: 
$currentDirectory = Get-Location
tempcertificatePath= Join-Path -Path $currentDirectory -ChildPath $env:Wap_Project_Directory -AdditionalChildPath $env:SigningCertificate
echo "CertificatePath=${{ tempcertificatePath }}" >> $GITHUB_ENV

谢谢!

如果要在run步骤中运行多行,则需要使用|。此外,在分配变量时,不需要使用左侧的$

示例:

- run: |
myVar="foo"
mySecondVar="${myVar}bar"
echo $mySecondVar

最新更新