9 Commits

Author SHA1 Message Date
d1c63de5d1 Release v1.0.37
Some checks failed
Release Build / create-release (push) Failing after 6s
Release Build / create-docker-image (push) Has been skipped
Release Build / update-to-release-branch (push) Has been skipped
2025-07-28 17:57:02 +06:00
9e431a00ce Release v1.0.36
Some checks failed
Release Build / create-release (push) Failing after 6m14s
Release Build / create-docker-image (push) Has been skipped
Release Build / update-to-release-branch (push) Has been skipped
2025-07-28 17:44:23 +06:00
75822f7fb8 Release v1.0.35
Some checks failed
Release Build / create-release (push) Failing after 6m17s
Release Build / create-docker-image (push) Has been skipped
Release Build / update-to-release-branch (push) Has been skipped
2025-07-28 17:33:06 +06:00
707cd82717 Release v1.0.34
Some checks failed
Release Build / create-release (push) Failing after 6m29s
Release Build / create-docker-image (push) Has been skipped
Release Build / update-to-release-branch (push) Has been skipped
2025-07-28 17:11:14 +06:00
6f10caa69d Release v1.0.33
Some checks failed
Release Build / create-release (push) Successful in 6m37s
Release Build / create-docker-image (push) Failing after 37s
Release Build / update-to-release-branch (push) Has been skipped
2025-07-28 17:00:47 +06:00
da3538051e Release v1.0.33
Some checks failed
Release Build / create-release (push) Failing after 3s
Release Build / create-docker-image (push) Has been skipped
Release Build / update-to-release-branch (push) Has been skipped
2025-07-28 16:59:35 +06:00
032bdaa619 Release v1.0.33
Some checks failed
Release Build / create-release (push) Failing after 2s
Release Build / create-docker-image (push) Has been skipped
Release Build / update-to-release-branch (push) Has been skipped
2025-07-28 16:56:50 +06:00
b786ed1bf8 Release v1.0.33
Some checks failed
Release Build / create-release (push) Failing after 3s
Release Build / create-docker-image (push) Has been skipped
Release Build / update-to-release-branch (push) Has been skipped
2025-07-28 16:55:34 +06:00
231867a310 Release v1.0.33
Some checks failed
Release Build / create-release (push) Failing after 2s
Release Build / create-docker-image (push) Has been skipped
Release Build / update-to-release-branch (push) Has been skipped
2025-07-28 16:50:29 +06:00
6 changed files with 86 additions and 32 deletions

View File

@@ -9,6 +9,7 @@ jobs:
runs-on: ubuntu-latest
container:
# image: golang:1.21
# image: ${{ secrets.DOCKERHUB_USERNAME }}/my-build-golang-runner:builder-1.0.32
image: ${{ secrets.DOCKERHUB_USERNAME }}/my-build-golang-runner:latest
steps:
- name: Checkout repository
@@ -16,7 +17,6 @@ jobs:
git clone https://oauth2:${{ secrets.GITEATOKEN }}@direct-dev.ru/gitea/GiteaAdmin/hello_gitea.git hello_gitea
cd hello_gitea
git checkout ${{ github.ref }}
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/my-build-golang-runner:latest
- name: Setup Go
run: |
@@ -30,35 +30,59 @@ jobs:
run: |
cd hello_gitea
mkdir -p bin
echo "Building for all platforms..."
mv usr/local/bin/quick-build quick-build.sh
chmod +x quick-build.sh
# Build for all platforms
quick-build linux amd64
quick-build linux arm64
quick-build windows amd64
quick-build darwin amd64
quick-build darwin arm64
echo "Building for linux amd64..."
quick-build.sh linux amd64
# Build for all platforms
GOOS=linux GOARCH=amd64 go build -o bin/hello-api-linux-amd64 main.go
GOOS=linux GOARCH=arm64 go build -o bin/hello-api-linux-arm64 main.go
GOOS=windows GOARCH=amd64 go build -o bin/hello-api-windows-amd64.exe main.go
GOOS=darwin GOARCH=amd64 go build -o bin/hello-api-darwin-amd64 main.go
GOOS=darwin GOARCH=arm64 go build -o bin/hello-api-darwin-arm64 main.go
echo "Building for linux arm64..."
quick-build.sh linux arm64
echo "Building for windows amd64..."
quick-build.sh windows amd64
echo "Building for darwin amd64..."
quick-build.sh darwin amd64
echo "Building for darwin arm64..."
quick-build.sh darwin arm64
echo "Listing bin directory..."
ls -la bin
# Create archives
echo "Creating archives..."
cd bin
# Create archives with correct file names
echo "Creating archives for linux amd64..."
tar -czf hello-api-linux-amd64.tar.gz hello-api-linux-amd64
echo "Creating archives for linux arm64..."
tar -czf hello-api-linux-arm64.tar.gz hello-api-linux-arm64
echo "Creating archives for windows amd64..."
mv hello-api-windows-amd64 hello-api-windows-amd64.exe
tar -czf hello-api-windows-amd64.tar.gz hello-api-windows-amd64.exe
echo "Creating archives for darwin amd64..."
tar -czf hello-api-darwin-amd64.tar.gz hello-api-darwin-amd64
echo "Creating archives for darwin arm64..."
tar -czf hello-api-darwin-arm64.tar.gz hello-api-darwin-arm64
echo "Listing bin directory again ..."
ls -la
- name: Create Release
run: |
cd hello_gitea
# Create release using Gitea API
echo "Creating release..."
curl -X POST \
-H "Authorization: token ${{ secrets.GITEATOKEN }}" \
-H "Content-Type: application/json" \
@@ -71,12 +95,13 @@ jobs:
}' \
"https://direct-dev.ru/gitea/api/v1/repos/GiteaAdmin/hello_gitea/releases"
# Upload assets
echo "Getting release id..."
RELEASE_ID=$(curl -s -H "Authorization: token ${{ secrets.GITEATOKEN }}" \
"https://direct-dev.ru/gitea/api/v1/repos/GiteaAdmin/hello_gitea/releases/tags/${{ github.ref_name }}" | \
jq -r '.id')
# Upload all binaries
echo "Uploading assets..."
for file in bin/*.tar.gz; do
echo "Uploading $file..."
curl -X POST \
@@ -86,6 +111,8 @@ jobs:
"https://direct-dev.ru/gitea/api/v1/repos/GiteaAdmin/hello_gitea/releases/$RELEASE_ID/assets?name=$(basename $file)"
done
echo "Release created successfully"
create-docker-image:
runs-on: ubuntu-latest
container:
@@ -111,7 +138,7 @@ jobs:
run: |
# Docker is already installed in docker:dind image
docker --version
echo "Setting up Docker Buildx for multi-platform builds..."
# Setup Docker Buildx for multi-platform builds
docker buildx create --name go-buildx --use
docker buildx inspect --bootstrap
@@ -123,6 +150,7 @@ jobs:
- name: Build multi-platform Docker images
run: |
cd hello_gitea
echo "Building multi-platform images using buildx..."
# Build multi-platform images using buildx
docker buildx build \
--platform linux/amd64,linux/arm64 \
@@ -130,8 +158,11 @@ jobs:
--tag ${{ secrets.DOCKERHUB_USERNAME }}/hello-api:latest \
--push \
.
echo "Multi-platform images built successfully"
- name: Remove buildx
run: |
echo "Removing buildx..."
docker buildx rm go-buildx
update-to-release-branch:
@@ -142,6 +173,7 @@ jobs:
steps:
- name: Create Release Branch
run: |
echo "Creating release branch..."
echo "=== GitHub Variables ==="
echo "github.ref = ${{ github.ref }}"
echo "github.ref_name = ${{ github.ref_name }}"
@@ -180,3 +212,4 @@ jobs:
# Push changes to release branch
echo "Pushing changes to release branch..."
git push origin release --force
echo "Changes pushed to release branch successfully"

View File

@@ -1,5 +1,5 @@
# Build stage
FROM --platform=$BUILDPLATFORM golang:1.21-alpine AS builder
FROM --platform=$BUILDPLATFORM golang:1.24-alpine AS builder
# Install git and ca-certificates
RUN apk --no-cache add git ca-certificates

View File

@@ -11,7 +11,7 @@ import (
"github.com/gin-gonic/gin"
)
const version = "1.0.32"
const version = "1.0.37"
// SystemInfo holds system information
type SystemInfo struct {

View File

@@ -2,7 +2,7 @@
BIN_DIR=bin
APP_NAME=hello-api
VERSION=1.0.32
VERSION=1.0.37
build:
mkdir -p $(BIN_DIR)

View File

@@ -13,7 +13,9 @@ fi
# Собираем для указанной платформы
if [ -n "$1" ] && [ -n "$2" ]; then
GOOS=$1 GOARCH=$2 go build -o "hello-api-$1-$2" main.go
echo "Building for $1 $2..."
GOOS=$1 GOARCH=$2 go build -o "bin/hello-api-$1-$2" main.go
else
go build -o hello-api main.go
echo "Building for current platform..."
go build -o bin/hello-api main.go
fi

View File

@@ -36,6 +36,9 @@ get_version_interactive() {
echo "📝 Подтверждение:"
echo " Текущая версия: $CURRENT_VERSION"
echo " Новая версия: $VERSION"
if [ "$CURRENT_VERSION" == "$VERSION" ]; then
echo "⚠️ Новая версия совпадает с текущей. Возможно будет обновлен тег ..."
fi
echo ""
read -r -p "Продолжить? (y/N): " CONFIRM
@@ -68,11 +71,27 @@ if ! git rev-parse --git-dir > /dev/null 2>&1; then
exit 1
fi
# Проверяем, что нет незакоммиченных изменений
# if ! git diff-index --quiet HEAD --; then
# echo "Ошибка: Есть незакоммиченные изменения. Сначала закоммитьте их."
# exit 1
# fi
# Проверяем, существует ли уже тег с такой версией
if git tag -l "v$VERSION" | grep -q "v$VERSION"; then
echo "⚠️ Тег v$VERSION уже существует!"
echo ""
read -r -p "Обновить существующий тег? (y/N): " UPDATE_TAG
if [[ ! $UPDATE_TAG =~ ^[Yy]$ ]]; then
echo "❌ Обновление тега отменено"
exit 0
fi
echo "🔄 Обновляем существующий тег..."
# Удаляем локальный тег
git tag -d "v$VERSION" 2>/dev/null || true
# Удаляем удаленный тег
git push origin ":refs/tags/v$VERSION" 2>/dev/null || true
echo "✅ Старый тег удален"
fi
# Обновляем версию в main.go
echo "📝 Обновляем версию в main.go..."