Skip to content

Commit f28a9ed

Browse files
committed
[TASK] Allow workflow dispatch for publish
1 parent 6684c61 commit f28a9ed

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

.github/workflows/publish.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,16 @@ on:
44
push:
55
tags:
66
- "*"
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: 'The tag to publish'
11+
required: true
712

813
jobs:
914
publish:
1015
name: Publish new version to TER
11-
if: startsWith(github.ref, 'refs/tags/') && (github.repository == 'benjaminkott/bootstrap_package')
16+
if: (startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch') && (github.repository == 'benjaminkott/bootstrap_package')
1217
runs-on: ubuntu-latest
1318
env:
1419
TYPO3_EXTENSION_KEY: ${{ secrets.TYPO3_EXTENSION_KEY }}
@@ -17,19 +22,28 @@ jobs:
1722
steps:
1823
- name: Checkout repository
1924
uses: actions/checkout@v4
25+
with:
26+
ref: ${{ github.event.inputs.tag || github.ref }}
27+
28+
- name: Get version
29+
id: get-version
30+
run: |
31+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
32+
echo "version=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
33+
else
34+
echo "version=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
35+
fi
2036
2137
- name: Check tag
2238
run: |
23-
if ! [[ ${{ github.ref }} =~ ^refs/tags/[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$ ]]; then
39+
if ! [[ ${{ steps.get-version.outputs.version }} =~ ^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$ ]]; then
2440
exit 1
2541
fi
26-
- name: Get version
27-
id: get-version
28-
run: echo "version=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
2942
3043
- name: Get comment
3144
id: get-comment
3245
run: |
46+
git fetch --tags
3347
readonly local comment=$(git tag -n10 -l ${{ steps.get-version.outputs.version }} | sed "s/^[0-9.]*[ ]*//g")
3448
if [[ -z "${comment// }" ]]; then
3549
echo "comment=Released version ${{ steps.get-version.outputs.version }} of ${{ env.TYPO3_EXTENSION_KEY }}" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)