我有以下条件:
name: Build Image
on:
push:
pull_request:
workflow_dispatch:
jobs:
build-image: (This should be only if the tag contains "azure")
name: Build Image Job
runs-on: [ self-hosted ]
steps:
- uses: actions/checkout@v2
- name: Run Build Step
run: |
ANSIBLE_VERSION=$(cat VERSION)
docker images
jobs:
build-image: (This will be for everything else)
name: Build Image Job
runs-on: [ self-hosted ]
steps:
- uses: actions/checkout@v2
- name: Run Build Step
run: |
ANSIBLE_VERSION=$(cat VERSION)
docker images如何才能做到这一点?如何引用作业中的标记?你是如何建立变量的,并从中制定一个假设规则的?
发布于 2021-12-05 11:33:36
您可以在on配置中使用regex基于标记名触发工作流。例如:
on:
push:
tags:
- '*azure*'在作业或步骤级别上,可以使用contains()表达式:
jobs:
build-for-azure-tag:
name: build-for-azure-tag
runs-on: ubuntu-latest
if: github.ref_type == 'tag' && contains(github.ref_name, 'azure')https://stackoverflow.com/questions/70233593
复制相似问题