可以使用其中一个安装操作来设置环境。

语言设置操作
.NETactions/setup-dotnet
ASP.NETactions/setup-dotnet
Javaactions/setup-java
JavaScriptactions/setup-node
Pythonactions/setup-python

以下示例演示如何为不同受支持的语言设置环境:

.NET
name: Setup Dotnet 3.3.x
uses: actions/setup-dotnet@v1
with:
  dotnet-version: '3.3.x'
ASP.NET
    - name: Install Nuget
      uses: nuget/setup-nuget@v1
      with:
        nuget-version: ${{ env.NUGET_VERSION}}
Java
    - name: Setup Java 1.8.x
      uses: actions/setup-java@v1
      with:
        # If your pom.xml <maven.compiler.source> version is not in 1.8.x,
        # change the Java version to match the version in pom.xml <maven.compiler.source>
        java-version: '1.8.x'
JavaScript
env:
  NODE_VERSION: '14.x'                # set this to the node version to use

jobs:
  build-and-deploy:
    name: Build and Deploy
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@main
    - name: Use Node.js ${{ env.NODE_VERSION }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ env.NODE_VERSION }}
Python
    - name: Setup Python 3.x 
      uses: actions/setup-python@v1
      with:
        python-version: 3.x
Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐