Skip to content

Commit d867471

Browse files
authored
Merge pull request #199 from appliedAI-Initiative/ci/manual-pypi
Allow manual triggering of pypi releases
2 parents ba64bd2 + dfad59b commit d867471

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

.github/workflows/publish.yaml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ on:
44
push:
55
tags:
66
- "v*"
7+
workflow_dispatch:
8+
inputs:
9+
reason:
10+
description: Why did you trigger the pipeline?
11+
required: False
12+
default: Check if it runs again due to external changes
713

814
env:
915
PY_COLORS: 1
@@ -17,8 +23,18 @@ jobs:
1723
- uses: actions/checkout@v3
1824
with:
1925
fetch-depth: 0
20-
- name: Fail if not on 'master' branch
21-
if: github.ref != 'refs/heads/master'
26+
- name: Fail if manually triggered workflow is not on 'master' branch
27+
if: github.event_name == 'workflow_dispatch' && github.ref_name != 'master'
28+
run: exit -1
29+
- name: Extract branch name from tag
30+
id: get_branch_name
31+
if: github.ref_type == 'tag'
32+
run: |
33+
export BRANCH_NAME=$(git log -1 --format='%D' $GITHUB_REF | | sed -e 's/.*origin\/\(.*\),.*/\1/')
34+
echo ::set-output name=branch_name::${BRANCH_NAME}
35+
shell: bash
36+
- name: Fail if tag is not on 'master' branch
37+
if: github.ref_type == 'tag' && steps.get_branch_name.outputs.branch_name != 'master'
2238
run: exit -1
2339
- name: Set up Python 3.8
2440
uses: actions/setup-python@v4

0 commit comments

Comments
 (0)