相关疑难解决方法(0)

Github Actions,如何在工作步骤之间共享计算值?

Github Actions是否有DRY方式在多个作业步骤中计算和共享值?

在下面的工作流程yml文件中,回显$ {GITHUB_REF} | cut -d'/'-f3`-$ {GITHUB_SHA}会分多个步骤重复。

name: Test, Build and Deploy
on:
  push:
    branches:
      - master
jobs:
  build_and_push:
    name: Build and Push
    runs-on: ubuntu-latest
    steps:
      - name: Docker Build
        uses: "actions/docker/cli@master"
        with:
          args: build . --file Dockerfile -t cflynnus/blog:`echo ${GITHUB_REF} | cut -d'/' -f3`-${GITHUB_SHA}
      - name: Docker Tag Latest
        uses: "actions/docker/cli@master"
        with:
          args: tag cflynnus/blog:`echo ${GITHUB_REF} | cut -d'/' -f3`-${GITHUB_SHA} cflynnus/blog:latest
Run Code Online (Sandbox Code Playgroud)

github github-actions

5
推荐指数
2
解决办法
282
查看次数

标签 统计

github ×1

github-actions ×1