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

Improvements to GitHub workflows #145

Merged
merged 4 commits into from
Nov 24, 2024
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
44 changes: 25 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
- uses: pnpm/action-setup@v3
with:
version: 9
Expand All @@ -67,7 +67,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
- uses: pnpm/action-setup@v3
with:
version: 9
Expand All @@ -83,7 +83,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
- uses: pnpm/action-setup@v3
with:
version: 9
Expand Down Expand Up @@ -186,16 +186,17 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
- uses: pnpm/action-setup@v3
with:
version: 9
- uses: actions/setup-go@v5
with:
go-version: '1.22.7'
cache: false
cache: false
- name: Set CLI version number
run: bash ./scripts/set-cli-version.sh test
- name: Run build script
working-directory: ./
run: make build

build-cli-linux-arm64:
Expand All @@ -211,16 +212,17 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
- uses: pnpm/action-setup@v3
with:
version: 9
- uses: actions/setup-go@v5
with:
go-version: '1.22.7'
cache: false
- name: Set CLI version number
run: bash ./scripts/set-cli-version.sh test
- name: Run build script
working-directory: ./
run: make build

build-cli-macos-15:
Expand All @@ -236,16 +238,17 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
- uses: pnpm/action-setup@v3
with:
version: 9
- uses: actions/setup-go@v5
with:
go-version: '1.22.7'
cache: false
- name: Set CLI version number
run: bash ./scripts/set-cli-version.sh test
- name: Run build script
working-directory: ./
run: make build

build-cli-macos-14:
Expand All @@ -261,16 +264,17 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
- uses: pnpm/action-setup@v3
with:
version: 9
- uses: actions/setup-go@v5
with:
go-version: '1.22.7'
cache: false
cache: false
- name: Set CLI version number
run: bash ./scripts/set-cli-version.sh test
- name: Run build script
working-directory: ./
run: make build

build-cli-macos-13:
Expand All @@ -286,16 +290,17 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
- uses: pnpm/action-setup@v3
with:
version: 9
- uses: actions/setup-go@v5
with:
go-version: '1.22.7'
cache: false
cache: false
- name: Set CLI version number
run: bash ./scripts/set-cli-version.sh test
- name: Run build script
working-directory: ./
run: make build

build-cli-windows:
Expand All @@ -311,14 +316,15 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
- uses: pnpm/action-setup@v3
with:
version: 9
- uses: actions/setup-go@v5
with:
go-version: '1.22.7'
cache: false
cache: false
- name: Set CLI version number
run: bash ./scripts/set-cli-version.sh test
- name: Run build script
working-directory: ./
run: make build
10 changes: 8 additions & 2 deletions .github/workflows/release-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ jobs:
GOARCH: amd64
runs-on: ${{ matrix.os }}
steps:
- name: Get tag name
uses: olegtarasov/[email protected]
id: tagName
with:
tagRegex: "cli/v(.*)"
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
Expand All @@ -39,9 +44,10 @@ jobs:
- uses: actions/setup-go@v5
with:
go-version: '1.22.7'
cache: false
cache: false
- name: Set CLI version number
run: bash ./scripts/set-cli-version.sh ${{ steps.tagName.outputs.tag }}
- name: Run build script
working-directory: ./
run: make build
- name: Append os/arch to binary file name
run: mv bin/kubetail bin/kubetail-${{ matrix.GOOS }}-${{ matrix.GOARCH }}
Expand Down
2 changes: 1 addition & 1 deletion modules/cli/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "kubetail",
Version: "0.0.7",
Version: "dev",
Short: "Kubetail - Kubernetes logging utility",
}

Expand Down
22 changes: 22 additions & 0 deletions scripts/set-cli-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# Check if a version number was provided as an argument
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <new-version>"
exit 1
fi

# Assign the new version number from command line arguments
NEW_VERSION=$1
CLI_ROOT_GO_FILE="./modules/cli/cmd/root.go"

# Check if the file exists
if [ ! -f "$CLI_ROOT_GO_FILE" ]; then
echo "Error: File $CLI_ROOT_GO_FILE not found."
exit 1
fi

# Update the Version field in the root.go file
sed -i.bak -E "s/(Version: )\"[^\"]*\"/\1\"$NEW_VERSION\"/" "$CLI_ROOT_GO_FILE" && rm "$CLI_ROOT_GO_FILE.bak"

echo "Version in $CLI_ROOT_GO_FILE updated to '$NEW_VERSION'."