From 2b089c68e64e5919b7ea384edad702da4fb2dc90 Mon Sep 17 00:00:00 2001 From: Vadim Date: Sat, 7 Mar 2026 13:34:24 +0300 Subject: [PATCH] wip ci/cd --- .gitea/workflows/build.yaml | 17 ----------------- .gitea/workflows/deploy.yaml | 35 +++++++++++++++++++++++++++++++++++ .gitignore | 1 + Makefile | 6 +++--- README.md | 12 +++++++++--- 5 files changed, 48 insertions(+), 23 deletions(-) delete mode 100644 .gitea/workflows/build.yaml create mode 100644 .gitea/workflows/deploy.yaml diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml deleted file mode 100644 index 88f137b..0000000 --- a/.gitea/workflows/build.yaml +++ /dev/null @@ -1,17 +0,0 @@ -name: Gitea Actions Demo -run-name: Deploy 🚀 -on: - push: - branches: - - main - -jobs: - Explore-Gitea-Actions: - runs-on: ubuntu-latest - steps: - - name: List files in the repository - run: | - ls ${{ gitea.workspace }} - - - name: Execute a single command - run: echo "Hello, world!" \ No newline at end of file diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml new file mode 100644 index 0000000..b6f22ec --- /dev/null +++ b/.gitea/workflows/deploy.yaml @@ -0,0 +1,35 @@ +name: Gitea Actions Demo +run-name: Deploy 🚀 +on: + push: + branches: + - main + +jobs: + Explore-Gitea-Actions: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6 +# - name: Setup Go +# uses: actions/setup-go@v6 +# with: +# go-version: '1.25' + - name: Docker build + run: docker build --tag git.madsky.ru/vadim/tracker:latest . + - name: Login to gitea + uses: docker/login-action@v4 + with: + registry: git.madsky.ru + username: ${{ vars.GITEA_USERNAME }} + password: ${{ secrets.GITEA_PASSWORD }} + - name: Push Docker image + run: | + IMAGE_TAG="git.madsky.ru/vadim/tracker:latest:${{ gitea.sha }}" + docker tag git.madsky.ru/vadim/tracker:latest $IMAGE_TAG + docker push $IMAGE_TAG + - name: List files in the repository + run: | + ls ${{ gitea.workspace }} + - name: Execute a single command + run: echo "Hello, world!" \ No newline at end of file diff --git a/.gitignore b/.gitignore index 327e57d..c0bc3c4 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ coverage *.tsbuildinfo /bin/ /config/config.yaml +main \ No newline at end of file diff --git a/Makefile b/Makefile index 4655ab5..5051058 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -BINARY_NAME=server +BINARY_NAME=main MAIN_PACKAGE_PATH = ./cmd/main.go .PHONY: tidy @@ -8,12 +8,12 @@ tidy: .PHONY: build build: - CGO_ENABLED=0 go build -o bin/${BINARY_NAME} ${MAIN_PACKAGE_PATH} + CGO_ENABLED=0 go build -o ${BINARY_NAME} ${MAIN_PACKAGE_PATH} # GOARCH=arm64 GOOS=darwin go build -o bin/${BINARY_NAME} ${MAIN_PACKAGE_PATH} .PHONY: run run: build - ./bin/${BINARY_NAME} + ./${BINARY_NAME} .PHONY: gen gen: diff --git a/README.md b/README.md index 88bfbc3..a5c6b3c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Hello world -```Bash +```shell FROM golang:tip-trixie AS builder WORKDIR /app COPY go.mod go.sum ./ @@ -16,9 +16,15 @@ EXPOSE 3000 CMD ["./main"] ``` -``` -docker build --tag docker-gs-ping . +```shell +docker build --tag git.madsky.ru/vadim/tracker:latest . ``` +```shell +docker push git.madsky.ru/vadim/tracker +``` +```shell +docker login git.madsky.ru +```