File tree Expand file tree Collapse file tree 1 file changed +6
-17
lines changed Expand file tree Collapse file tree 1 file changed +6
-17
lines changed Original file line number Diff line number Diff line change 3
3
release :
4
4
types : [published]
5
5
workflow_dispatch :
6
- inputs :
7
- image_tag :
8
- description : " Image tag"
9
- required : true
10
6
11
7
jobs :
12
8
check-release :
21
17
22
18
- name : Set Image Tag
23
19
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
25
26
26
27
- name : Check Release Tag
27
28
run : |
31
32
fi
32
33
echo "Release tag format is valid."
33
34
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
-
46
35
build-and-push :
47
36
name : Build and Push
48
37
needs : check-release
You can’t perform that action at this time.
0 commit comments