Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version change scritp #16

Merged
merged 2 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/release-master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ jobs:
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV

- name: change kmesh version
if: github.ref_name != 'main'
env:
VERSION: ${{ github.ref_name }}
run: make update-version UPDATE_VERSION=${{ github.ref_name }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ jobs:
with:
go-version: ${{ matrix.go-version }}

- name: change kmesh version
env:
VERSION: ${{ github.ref_name }}
run: make update-version UPDATE_VERSION=${{ github.ref_name }}

- name: Making and packaging
env:
GOOS: ${{ matrix.os }}
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ test:
./hack/run-ut.sh --local
endif

UPDATE_VERSION ?= ${VERSION}
.PHONY: update-version
update-version:
./hack/update-version.sh VERSION=${UPDATE_VERSION}

.PHONY: clean
clean:
$(QUIET) rm -rf ./out
Expand Down
20 changes: 20 additions & 0 deletions hack/update-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# Check if a Makefile exists in the current directory
if [ ! -f "Makefile" ]; then
echo "Error: Makefile not found in the current directory."
exit 1
fi

# Check if the VERSION argument is provided
if [ -z "$1" ]; then
echo "Usage: $0 VERSION=<value>"
exit 1
fi

# Extract the VERSION value from the argument
version=$(echo "$1" | sed 's/VERSION=//g')

# Update the VERSION parameter in the Makefile
sed -i "s/^VERSION.*$/VERSION ?= $version/" Makefile
sed -i "s/^CHART_VERSION.*$/CHART_VERSION ?= $version/" Makefile
Loading