Files
History_Api/.gitea/workflows/build.yml
AzenKain 4db82af5da
Some checks failed
Build and Release / release (push) Failing after 51s
init
2026-03-25 22:33:16 +07:00

40 lines
1.0 KiB
YAML

name: Build and Release
run-name: ${{ gitea.actor }} build 🚀
on:
push:
branches:
- master
jobs:
release:
runs-on: ubuntu-latest
container:
image: azenkain/go-node:latest
steps:
- uses: actions/checkout@v4
- name: Create .env file
run: |
mkdir -p assets/resources
printf "%s" "${{ secrets.ENV_FILE }}" > assets/resources/.env
- name: Download Go dependencies
run: go mod download
- name: Build for linux (embed env)
run: GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o build/history-api ./cmd/history-api
- name: Stop and remove old containers
run: |
docker compose down --remove-orphans || true
- name: Clean up only this project images
run: |
docker image prune -f
- name: Build and restart containers
run: |
# Đảm bảo file .env tồn tại trước khi chạy
docker compose --env-file ./assets/resources/.env up -d --build