From d443e21d26824e1d5ce933e88ab9f7c4e6d66a5e Mon Sep 17 00:00:00 2001 From: Leonardo D'Ippolito Date: Sat, 9 Nov 2024 09:27:23 +0000 Subject: [PATCH] Go version fixes --- .../build-and-push-docker-images.yml | 5 --- ...ate-dependencies.sh => update-versions.sh} | 41 ++++++++++++++----- src/build/Dockerfile-adminconsole | 2 +- src/build/Dockerfile-authserver | 2 +- 4 files changed, 32 insertions(+), 18 deletions(-) rename src/authserver/{update-dependencies.sh => update-versions.sh} (65%) diff --git a/.github/workflows/build-and-push-docker-images.yml b/.github/workflows/build-and-push-docker-images.yml index 2c7c6b616..6dd500d1f 100644 --- a/.github/workflows/build-and-push-docker-images.yml +++ b/.github/workflows/build-and-push-docker-images.yml @@ -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: | diff --git a/src/authserver/update-dependencies.sh b/src/authserver/update-versions.sh similarity index 65% rename from src/authserver/update-dependencies.sh rename to src/authserver/update-versions.sh index 5f85a5a9a..09e9fe5b6 100755 --- a/src/authserver/update-dependencies.sh +++ b/src/authserver/update-versions.sh @@ -1,6 +1,6 @@ #!/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 @@ -8,7 +8,7 @@ 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() { @@ -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 @@ -29,8 +48,8 @@ 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" @@ -38,7 +57,7 @@ for dockerfile in "$BASE_DIR/build/Dockerfile" "$BASE_DIR/build/Dockerfile-test" 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 @@ -46,10 +65,10 @@ 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 @@ -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 @@ -84,4 +103,4 @@ go mod tidy echo "Updated adminconsole dependencies" -cd ../authserver +cd ../authserver \ No newline at end of file diff --git a/src/build/Dockerfile-adminconsole b/src/build/Dockerfile-adminconsole index 93c7d117c..3e70cae41 100644 --- a/src/build/Dockerfile-adminconsole +++ b/src/build/Dockerfile-adminconsole @@ -1,4 +1,4 @@ -FROM golang:1.23.2-alpine AS build +FROM golang:1.23.3-alpine AS build ARG version ARG buildDate diff --git a/src/build/Dockerfile-authserver b/src/build/Dockerfile-authserver index e6052b880..a21f995b2 100644 --- a/src/build/Dockerfile-authserver +++ b/src/build/Dockerfile-authserver @@ -1,4 +1,4 @@ -FROM golang:1.23.2-alpine AS build +FROM golang:1.23.3-alpine AS build ARG version ARG buildDate