Skip to content

Commit 69e2311

Browse files
committed
fix: release ci
1 parent 37b5bda commit 69e2311

File tree

2 files changed

+34
-5
lines changed

2 files changed

+34
-5
lines changed

.github/workflows/publish.yml

Lines changed: 26 additions & 4 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+
tag:
10+
description: 'Tag to publish (e.g., v1.2.3)'
11+
required: true
12+
type: string
713

814
jobs:
915
lint-and-test:
@@ -15,6 +21,8 @@ jobs:
1521
steps:
1622
- name: Checkout code
1723
uses: actions/checkout@v4
24+
with:
25+
ref: ${{ github.event.inputs.tag || github.ref }}
1826

1927
# Backend setup
2028
- name: Set up Go
@@ -79,11 +87,18 @@ jobs:
7987
steps:
8088
- name: Checkout code
8189
uses: actions/checkout@v4
90+
with:
91+
ref: ${{ github.event.inputs.tag || github.ref }}
8292

8393
- name: Extract version from tag
8494
id: version
8595
run: |
86-
VERSION=${GITHUB_REF#refs/tags/v}
96+
if [ -n "${{ github.event.inputs.tag }}" ]; then
97+
TAG="${{ github.event.inputs.tag }}"
98+
else
99+
TAG="${GITHUB_REF#refs/tags/}"
100+
fi
101+
VERSION=${TAG#v}
87102
echo "version=$VERSION" >> $GITHUB_OUTPUT
88103
echo "📦 Building version: $VERSION"
89104
@@ -120,23 +135,30 @@ jobs:
120135
- name: Extract custom title from tag
121136
id: release_title
122137
run: |
138+
if [ -n "${{ github.event.inputs.tag }}" ]; then
139+
TAG_NAME="${{ github.event.inputs.tag }}"
140+
else
141+
TAG_NAME="${{ github.ref_name }}"
142+
fi
143+
123144
# Get tag annotation
124-
TAG_MESSAGE=$(git tag -l --format='%(contents)' ${{ github.ref_name }})
145+
TAG_MESSAGE=$(git tag -l --format='%(contents)' "$TAG_NAME")
125146
126147
# Check if tag contains custom title
127148
if echo "$TAG_MESSAGE" | grep -q "CUSTOM_TITLE:"; then
128149
TITLE=$(echo "$TAG_MESSAGE" | grep "CUSTOM_TITLE:" | sed 's/CUSTOM_TITLE: //')
129150
echo "title=$TITLE" >> $GITHUB_OUTPUT
130151
echo "has_custom_title=true" >> $GITHUB_OUTPUT
131152
else
132-
echo "title=Release ${{ github.ref_name }}" >> $GITHUB_OUTPUT
153+
echo "title=Release $TAG_NAME" >> $GITHUB_OUTPUT
133154
echo "has_custom_title=false" >> $GITHUB_OUTPUT
134155
fi
156+
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
135157
136158
- name: Create GitHub Release
137159
uses: softprops/action-gh-release@v1
138160
with:
139-
tag_name: ${{ github.ref_name }}
161+
tag_name: ${{ steps.release_title.outputs.tag_name }}
140162
name: ${{ steps.release_title.outputs.title }}
141163
generate_release_notes: true
142164
body: |

.github/workflows/release.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,11 @@ jobs:
7676
7777
git push origin "v$VERSION"
7878
echo "✅ Created and pushed tag v$VERSION"
79-
echo "🚀 Publish workflow will now build and push Docker image"
79+
80+
- name: Trigger publish workflow
81+
run: |
82+
VERSION="${{ github.event.inputs.version }}"
83+
gh workflow run publish.yml -f tag="v$VERSION"
84+
echo "🚀 Triggered publish workflow for v$VERSION"
85+
env:
86+
GH_TOKEN: ${{ secrets.PAT_TOKEN }}

0 commit comments

Comments
 (0)