Skip to content

Commit 81e2eb8

Browse files
Merge pull request #18 from harmoniqs/feat/release-workflow
feat: link prepare-release and release workflows using workflow_call
2 parents 443c866 + b9d3c66 commit 81e2eb8

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

.github/workflows/prepare-release.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ jobs:
1313
runs-on: ubuntu-latest
1414
permissions:
1515
contents: write
16+
outputs:
17+
tag: v${{ github.event.inputs.version }}
1618
steps:
1719
- name: Checkout code
1820
uses: actions/checkout@v4
@@ -29,7 +31,6 @@ jobs:
2931
fi
3032
3133
# Update version in pyproject.toml
32-
# This specifically targets the 'version = "..."' line in the [project] section
3334
sed -i "s/^version = \".*\"/version = \"$VERSION\"/" pyproject.toml
3435
3536
- name: Commit and push
@@ -46,6 +47,13 @@ jobs:
4647
git push origin main
4748
fi
4849
49-
# Tag and push tag (this will trigger release.yml)
50+
# Tag and push tag
5051
git tag "v$VERSION"
5152
git push origin "v$VERSION"
53+
54+
release:
55+
needs: prepare
56+
uses: ./.github/workflows/release.yml
57+
with:
58+
tag: ${{ needs.prepare.outputs.tag }}
59+
secrets: inherit

.github/workflows/release.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ on:
44
push:
55
tags:
66
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: 'Tag to release (e.g. v1.2.3)'
11+
required: true
12+
workflow_call:
13+
inputs:
14+
tag:
15+
description: 'Tag to release'
16+
required: true
17+
type: string
718

819
jobs:
920
release:
@@ -31,14 +42,15 @@ jobs:
3142
env:
3243
GH_TOKEN: ${{ github.token }}
3344
run: |
34-
gh release create ${{ github.ref_name }} \
45+
TAG=${{ inputs.tag || github.ref_name }}
46+
gh release create "$TAG" \
3547
dist/* \
3648
--generate-notes \
37-
--title "Release ${{ github.ref_name }}"
49+
--title "Release $TAG"
3850
3951
- name: Update major version tag
4052
run: |
41-
TAG=${{ github.ref_name }}
53+
TAG=${{ inputs.tag || github.ref_name }}
4254
# If tag is v1.2.3, MAJOR is v1
4355
if [[ $TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
4456
MAJOR=${TAG%%.*}

0 commit comments

Comments
 (0)