Skip to content

Commit 31102d7

Browse files
authored
Update build job to run when a release is tagged (#161)
1 parent 84a9240 commit 31102d7

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

.github/workflows/build.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: Build Rust binaries
22
on:
3+
release:
4+
types: [published]
35
workflow_dispatch:
46
inputs:
57
version:
@@ -42,14 +44,23 @@ jobs:
4244
ext: ""
4345
target: aarch64-apple-darwin
4446
steps:
47+
- name: Get release tag value
48+
id: version-tag
49+
run: |
50+
if [ -n "${{ inputs.version }}" ]; then
51+
echo "ref=${{ inputs.version }}" >> $GITHUB_OUTPUT
52+
else
53+
ref=$(echo "$GITHUB_REF" | cut -d '/' -f3)
54+
echo "ref=$ref" >> $GITHUB_OUTPUT
55+
fi
4556
- name: Checkout
4657
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
4758
with:
4859
path: checkout-main
4960
- name: Checkout
5061
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
5162
with:
52-
ref: ${{ inputs.version }}
63+
ref: ${{ steps.version-tag.outputs.ref }}
5364
path: checkout-tag
5465
- name: Add target config for arm64 on Linux
5566
if: ${{ matrix.target.name == 'linux-arm64' }}
@@ -68,7 +79,7 @@ jobs:
6879
- name: Upload binaries to release
6980
uses: svenstaro/upload-release-action@v2
7081
with:
71-
tag: ${{ inputs.version }}
82+
tag: ${{ steps.version-tag.outputs.ref }}
7283
file: checkout-tag/target/${{ matrix.target.target }}/release/elasticsearch-core-mcp-server${{ matrix.target.ext }}
73-
asset_name: elasticsearch-core-mcp-server-${{ inputs.version }}-${{ matrix.target.name }}${{ matrix.target.ext }}
84+
asset_name: elasticsearch-core-mcp-server-${{ steps.version-tag.outputs.ref }}-${{ matrix.target.name }}${{ matrix.target.ext }}
7485
overwrite: true

0 commit comments

Comments
 (0)