Skip to content

Commit a60d4e6

Browse files
authored
Merge pull request #131 from firstbatchxyz/prod-image-workflow-version-fix [skip ci]
* get version from toml and remove dispatch input * fix typo * add comment
1 parent 6f61381 commit a60d4e6

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

.github/workflows/build_prod_container.yml

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ on:
33
release:
44
types: [published]
55
workflow_dispatch:
6-
inputs:
7-
image_tag:
8-
description: "Image tag"
9-
required: true
106

117
jobs:
128
check-release:
@@ -21,7 +17,12 @@ jobs:
2117

2218
- name: Set Image Tag
2319
id: itag
24-
run: echo "itag=${{ github.event.inputs.image_tag }}" >> $GITHUB_OUTPUT
20+
run: |
21+
CARGO_VERSION=$(awk '/\[workspace.package\]/ {flag=1} flag && /version =/ {print $3; flag=0}' Cargo.toml | sed 's/"//g')
22+
IMAGE_TAG=v${{ steps.itag.outputs.itag }} # set the image tag with "v" prefix
23+
echo "Cargo.toml version: $CARGO_VERSION"
24+
echo "Image tag: $IMAGE_TAG"
25+
echo "itag=$IMAGE_TAG" >> $GITHUB_OUTPUT
2526
2627
- name: Check Release Tag
2728
run: |
@@ -31,18 +32,6 @@ jobs:
3132
fi
3233
echo "Release tag format is valid."
3334
34-
- name: Check Cargo.toml Version
35-
run: |
36-
CARGO_VERSION=$(awk '/\[package\]/ {flag=1} flag && /version =/ {print $3; flag=0}' Cargo.toml | sed 's/"//g')
37-
TAG_VERSION=${{ steps.itag.outputs.itag }}
38-
TAG_VERSION=${TAG_VERSION#"v"} # Remove the leading 'v' from the tag
39-
40-
if [[ "$CARGO_VERSION" != "$TAG_VERSION" ]]; then
41-
echo "Version in Cargo.toml ($CARGO_VERSION) does not match the release tag version ($TAG_VERSION)."
42-
exit 1
43-
fi
44-
echo "Cargo.toml version matches the release tag."
45-
4635
build-and-push:
4736
name: Build and Push
4837
needs: check-release

0 commit comments

Comments
 (0)