Skip to content

Commit

Permalink
Go version fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
leodip committed Nov 9, 2024
1 parent 38acdc6 commit d443e21
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 18 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/build-and-push-docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ jobs:
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23.3'

- name: Build and push docker images
run: |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/bin/bash

# Set the new versions here
GOIABADA_VERSION="0.8"
NEW_GO_VERSION="1.23.3" # https://go.dev/dl/
NEW_TAILWIND_VERSION="3.4.14" # https://github.com/tailwindlabs/tailwindcss
NEW_GOLANGCI_LINT_VERSION="1.61.0" # https://github.com/golangci/golangci-lint
NEW_MOCKERY_VERSION="2.46.3" # https://github.com/vektra/mockery
NEW_DAISYUI_VERSION="4.12.14" # https://daisyui.com/
NEW_HUMANIZE_DURATION_VERSION="3.32.1" # https://www.npmjs.com/package/humanize-duration

BASE_DIR="../"
BASE_DIR="../../"

# Function to update version in files
update_version() {
Expand All @@ -20,6 +20,25 @@ update_version() {
echo "Updated $file: ${old_pattern} -> ${new_pattern}"
}

# Update GitHub Actions workflow Go version
GITHUB_WORKFLOW_FILE="$BASE_DIR/.github/workflows/build-binaries.yml"
if [ -f "$GITHUB_WORKFLOW_FILE" ]; then
update_version "$GITHUB_WORKFLOW_FILE" "go-version: '[0-9.]\+'" "go-version: '${NEW_GO_VERSION}'"
fi

# Update build scripts with Goiabada version
BUILD_SCRIPTS=(
"$BASE_DIR/src/build/build-binaries.sh"
"$BASE_DIR/src/build/build-docker-images.sh"
"$BASE_DIR/src/build/push-docker-images.sh"
)

for script in "${BUILD_SCRIPTS[@]}"; do
if [ -f "$script" ]; then
update_version "$script" 'VERSION="[0-9.]\+"' "VERSION=\"${GOIABADA_VERSION}\""
fi
done

# Update .devcontainer/Dockerfile
DEVCONTAINER_DOCKERFILE="$BASE_DIR/.devcontainer/Dockerfile"
if [ -f "$DEVCONTAINER_DOCKERFILE" ]; then
Expand All @@ -29,27 +48,27 @@ if [ -f "$DEVCONTAINER_DOCKERFILE" ]; then
update_version "$DEVCONTAINER_DOCKERFILE" "mockery/v2@v[0-9.]\+" "mockery/v2@v${NEW_MOCKERY_VERSION}"
fi

# Update build/Dockerfile and build/Dockerfile-test
for dockerfile in "$BASE_DIR/build/Dockerfile" "$BASE_DIR/build/Dockerfile-test"; do
# Update Dockerfile's
for dockerfile in "$BASE_DIR/src/build/Dockerfile-adminconsole" "$BASE_DIR/src/build/Dockerfile-authserver" "$BASE_DIR/src/build/Dockerfile-test"; do
if [ -f "$dockerfile" ]; then
update_version "$dockerfile" "golang:[0-9.]\+-alpine" "golang:${NEW_GO_VERSION}-alpine"
update_version "$dockerfile" "tailwindcss/releases/download/v[0-9.]\+/tailwindcss-linux-x64" "tailwindcss/releases/download/v${NEW_TAILWIND_VERSION}/tailwindcss-linux-x64"
fi
done

# Update go.mod files
for gomod in "$BASE_DIR/adminconsole/go.mod" "$BASE_DIR/authserver/go.mod" "$BASE_DIR/core/go.mod"; do
for gomod in "$BASE_DIR/src/adminconsole/go.mod" "$BASE_DIR/src/authserver/go.mod" "$BASE_DIR/src/core/go.mod"; do
if [ -f "$gomod" ]; then
update_version "$gomod" "go [0-9.]\+" "go ${NEW_GO_VERSION}"
fi
done

# Update daisyUI version in HTML files
DAISYUI_FILES=(
"$BASE_DIR/authserver/web/template/layouts/auth_layout.html"
"$BASE_DIR/authserver/web/template/layouts/no_menu_layout.html"
"$BASE_DIR/adminconsole/web/template/layouts/no_menu_layout.html"
"$BASE_DIR/adminconsole/web/template/layouts/menu_layout.html"
"$BASE_DIR/src/authserver/web/template/layouts/auth_layout.html"
"$BASE_DIR/src/authserver/web/template/layouts/no_menu_layout.html"
"$BASE_DIR/src/adminconsole/web/template/layouts/no_menu_layout.html"
"$BASE_DIR/src/adminconsole/web/template/layouts/menu_layout.html"
)

for html_file in "${DAISYUI_FILES[@]}"; do
Expand All @@ -59,7 +78,7 @@ for html_file in "${DAISYUI_FILES[@]}"; do
done

# Update humanize-duration version
MENU_LAYOUT_HTML="$BASE_DIR/adminconsole/web/template/layouts/menu_layout.html"
MENU_LAYOUT_HTML="$BASE_DIR/src/adminconsole/web/template/layouts/menu_layout.html"
if [ -f "$MENU_LAYOUT_HTML" ]; then
update_version "$MENU_LAYOUT_HTML" "humanize-duration@[0-9.]\+/" "humanize-duration@${NEW_HUMANIZE_DURATION_VERSION}/"
fi
Expand All @@ -84,4 +103,4 @@ go mod tidy

echo "Updated adminconsole dependencies"

cd ../authserver
cd ../authserver
2 changes: 1 addition & 1 deletion src/build/Dockerfile-adminconsole
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.23.2-alpine AS build
FROM golang:1.23.3-alpine AS build

ARG version
ARG buildDate
Expand Down
2 changes: 1 addition & 1 deletion src/build/Dockerfile-authserver
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.23.2-alpine AS build
FROM golang:1.23.3-alpine AS build

ARG version
ARG buildDate
Expand Down

0 comments on commit d443e21

Please sign in to comment.