mirror of
https://github.com/aykhans/bsky-feedgen.git
synced 2025-11-29 18:49:52 +00:00
update CI/CD
This commit is contained in:
177
Taskfile.yml
177
Taskfile.yml
@@ -3,104 +3,107 @@
|
||||
version: "3"
|
||||
|
||||
vars:
|
||||
DOCKER_REGISTRY: "git.aykhans.me/bsky/"
|
||||
DOCKER_REGISTRY: "git.aykhans.me"
|
||||
|
||||
tasks:
|
||||
ftl:
|
||||
cmds:
|
||||
- task: fmt
|
||||
- task: tidy
|
||||
- task: lint
|
||||
ftl:
|
||||
cmds:
|
||||
- task: fmt
|
||||
- task: tidy
|
||||
- task: lint
|
||||
|
||||
fmt: gofmt -w -d .
|
||||
fmt: gofmt -w -d .
|
||||
|
||||
tidy: go mod tidy
|
||||
tidy: go mod tidy
|
||||
|
||||
lint: golangci-lint run
|
||||
lint: golangci-lint run
|
||||
|
||||
run-consumer:
|
||||
cmd: go run ./cmd/consumer {{.CLI_ARGS}}
|
||||
dotenv:
|
||||
- config/app/consumer.env
|
||||
- config/app/mongodb.env
|
||||
run-consumer:
|
||||
cmd: go run ./cmd/consumer {{.CLI_ARGS}}
|
||||
dotenv:
|
||||
- config/app/consumer.env
|
||||
- config/app/mongodb.env
|
||||
|
||||
run-feedgen-az:
|
||||
cmd: go run ./cmd/feedgen/az {{.CLI_ARGS}}
|
||||
dotenv:
|
||||
- config/app/feedgen/az.env
|
||||
- config/app/mongodb.env
|
||||
run-feedgen-az:
|
||||
cmd: go run ./cmd/feedgen/az {{.CLI_ARGS}}
|
||||
dotenv:
|
||||
- config/app/feedgen/az.env
|
||||
- config/app/mongodb.env
|
||||
|
||||
run-api:
|
||||
cmd: go run ./cmd/api {{.CLI_ARGS}}
|
||||
dotenv:
|
||||
- config/app/api.env
|
||||
- config/app/mongodb.env
|
||||
run-api:
|
||||
cmd: go run ./cmd/api {{.CLI_ARGS}}
|
||||
dotenv:
|
||||
- config/app/api.env
|
||||
- config/app/mongodb.env
|
||||
|
||||
run-manager:
|
||||
cmd: go run cmd/manager/main.go {{.CLI_ARGS}}
|
||||
run-manager:
|
||||
cmd: go run cmd/manager/main.go {{.CLI_ARGS}}
|
||||
|
||||
docker-publish-all:
|
||||
desc: Publish docker images for all services
|
||||
cmds:
|
||||
- task: docker-publish-api
|
||||
- task: docker-publish-consumer
|
||||
- task: docker-publish-feedgen-az
|
||||
- task: docker-publish-manager
|
||||
docker-publish-all:
|
||||
desc: Publish docker images for all services
|
||||
cmds:
|
||||
- task: docker-publish-api
|
||||
- task: docker-publish-consumer
|
||||
- task: docker-publish-feedgen-az
|
||||
- task: docker-publish-manager
|
||||
|
||||
docker-publish-api:
|
||||
desc: Publish docker image for api service
|
||||
vars:
|
||||
GO_VERSION_FILE: ./cmd/api/version.go
|
||||
IMAGE_NAME: feedgen-api
|
||||
VERSION:
|
||||
sh: grep -o 'const version = "[^"]*"' {{.GO_VERSION_FILE}} | grep -o '"[^"]*"' | tr -d '"'
|
||||
VERSIONED_IMAGE: "{{.DOCKER_REGISTRY}}{{.IMAGE_NAME}}:{{.VERSION}}"
|
||||
LATEST_IMAGE: "{{.DOCKER_REGISTRY}}{{.IMAGE_NAME}}:latest"
|
||||
preconditions:
|
||||
- test -f {{.GO_VERSION_FILE}}
|
||||
- sh: '[ -n "{{.VERSION}}" ]'
|
||||
msg: "Could not extract version from {{.GO_FILE}}"
|
||||
cmds:
|
||||
- docker build -t {{.VERSIONED_IMAGE}} -f ./cmd/api/Dockerfile .
|
||||
- docker tag {{.VERSIONED_IMAGE}} {{.LATEST_IMAGE}}
|
||||
- docker push {{.VERSIONED_IMAGE}}
|
||||
- docker push {{.LATEST_IMAGE}}
|
||||
- echo "Published {{.VERSIONED_IMAGE}} and {{.LATEST_IMAGE}}"
|
||||
docker-publish-api:
|
||||
desc: Publish docker image for api service
|
||||
vars:
|
||||
GO_VERSION_FILE: ./cmd/api/version.go
|
||||
IMAGE_NAME: /bsky/feedgen-api
|
||||
VERSION:
|
||||
sh: grep -o 'const version = "[^"]*"' {{.GO_VERSION_FILE}} | grep -o '"[^"]*"' | tr -d '"'
|
||||
VERSIONED_IMAGE: "{{.DOCKER_REGISTRY}}{{.IMAGE_NAME}}:{{.VERSION}}"
|
||||
LATEST_IMAGE: "{{.DOCKER_REGISTRY}}{{.IMAGE_NAME}}:latest"
|
||||
preconditions:
|
||||
- test -f {{.GO_VERSION_FILE}}
|
||||
- sh: '[ -n "{{.VERSION}}" ]'
|
||||
msg: "Could not extract version from {{.GO_FILE}}"
|
||||
cmds:
|
||||
- docker build -t {{.VERSIONED_IMAGE}} -f ./cmd/api/Dockerfile .
|
||||
- docker tag {{.VERSIONED_IMAGE}} {{.LATEST_IMAGE}}
|
||||
- docker push {{.VERSIONED_IMAGE}}
|
||||
- docker push {{.LATEST_IMAGE}}
|
||||
- echo "Published {{.VERSIONED_IMAGE}} and {{.LATEST_IMAGE}}"
|
||||
|
||||
docker-publish-consumer:
|
||||
desc: Publish docker image for consumer service
|
||||
vars:
|
||||
GO_VERSION_FILE: ./cmd/consumer/version.go
|
||||
IMAGE_NAME: feedgen-consumer
|
||||
VERSION:
|
||||
sh: grep -o 'const version = "[^"]*"' {{.GO_VERSION_FILE}} | grep -o '"[^"]*"' | tr -d '"'
|
||||
VERSIONED_IMAGE: "{{.DOCKER_REGISTRY}}{{.IMAGE_NAME}}:{{.VERSION}}"
|
||||
LATEST_IMAGE: "{{.DOCKER_REGISTRY}}{{.IMAGE_NAME}}:latest"
|
||||
cmds:
|
||||
- docker build -t {{.VERSIONED_IMAGE}} -f ./cmd/consumer/Dockerfile .
|
||||
- docker push {{.VERSIONED_IMAGE}}
|
||||
- docker tag {{.VERSIONED_IMAGE}} {{.LATEST_IMAGE}}
|
||||
- docker push {{.LATEST_IMAGE}}
|
||||
- echo "Published {{.VERSIONED_IMAGE}} and {{.LATEST_IMAGE}}"
|
||||
docker-publish-consumer:
|
||||
desc: Publish docker image for consumer service
|
||||
vars:
|
||||
GO_VERSION_FILE: ./cmd/consumer/version.go
|
||||
IMAGE_NAME: /bsky/feedgen-consumer
|
||||
VERSION:
|
||||
sh: grep -o 'const version = "[^"]*"' {{.GO_VERSION_FILE}} | grep -o '"[^"]*"' | tr -d '"'
|
||||
VERSIONED_IMAGE: "{{.DOCKER_REGISTRY}}{{.IMAGE_NAME}}:{{.VERSION}}"
|
||||
LATEST_IMAGE: "{{.DOCKER_REGISTRY}}{{.IMAGE_NAME}}:latest"
|
||||
cmds:
|
||||
- docker build -t {{.VERSIONED_IMAGE}} -f ./cmd/consumer/Dockerfile .
|
||||
- docker push {{.VERSIONED_IMAGE}}
|
||||
- docker tag {{.VERSIONED_IMAGE}} {{.LATEST_IMAGE}}
|
||||
- docker push {{.LATEST_IMAGE}}
|
||||
- echo "Published {{.VERSIONED_IMAGE}} and {{.LATEST_IMAGE}}"
|
||||
|
||||
docker-publish-feedgen-az:
|
||||
desc: Publish docker image for feedgen-az service
|
||||
vars:
|
||||
GO_VERSION_FILE: ./cmd/feedgen/az/version.go
|
||||
IMAGE_NAME: feedgen-generator-az
|
||||
VERSION:
|
||||
sh: grep -o 'const version = "[^"]*"' {{.GO_VERSION_FILE}} | grep -o '"[^"]*"' | tr -d '"'
|
||||
VERSIONED_IMAGE: "{{.DOCKER_REGISTRY}}{{.IMAGE_NAME}}:{{.VERSION}}"
|
||||
LATEST_IMAGE: "{{.DOCKER_REGISTRY}}{{.IMAGE_NAME}}:latest"
|
||||
cmds:
|
||||
- docker build -t {{.VERSIONED_IMAGE}} -f ./cmd/feedgen/az/Dockerfile .
|
||||
- docker push {{.VERSIONED_IMAGE}}
|
||||
- docker tag {{.VERSIONED_IMAGE}} {{.LATEST_IMAGE}}
|
||||
- docker push {{.LATEST_IMAGE}}
|
||||
- echo "Published {{.VERSIONED_IMAGE}} and {{.LATEST_IMAGE}}"
|
||||
docker-publish-feedgen-az:
|
||||
desc: Publish docker image for feedgen-az service
|
||||
vars:
|
||||
GO_VERSION_FILE: ./cmd/feedgen/az/version.go
|
||||
IMAGE_NAME: /bsky/feedgen-generator-az
|
||||
VERSION:
|
||||
sh: grep -o 'const version = "[^"]*"' {{.GO_VERSION_FILE}} | grep -o '"[^"]*"' | tr -d '"'
|
||||
VERSIONED_IMAGE: "{{.DOCKER_REGISTRY}}{{.IMAGE_NAME}}:{{.VERSION}}"
|
||||
LATEST_IMAGE: "{{.DOCKER_REGISTRY}}{{.IMAGE_NAME}}:latest"
|
||||
cmds:
|
||||
- docker build -t {{.VERSIONED_IMAGE}} -f ./cmd/feedgen/az/Dockerfile .
|
||||
- docker push {{.VERSIONED_IMAGE}}
|
||||
- docker tag {{.VERSIONED_IMAGE}} {{.LATEST_IMAGE}}
|
||||
- docker push {{.LATEST_IMAGE}}
|
||||
- echo "Published {{.VERSIONED_IMAGE}} and {{.LATEST_IMAGE}}"
|
||||
|
||||
docker-publish-manager:
|
||||
desc: Publish docker image for manager service
|
||||
cmds:
|
||||
- docker build -t git.aykhans.me/bsky/feedgen-manager:latest -f ./cmd/manager/Dockerfile .
|
||||
- docker push git.aykhans.me/bsky/feedgen-manager:latest
|
||||
docker-publish-manager:
|
||||
desc: Publish docker image for manager service
|
||||
vars:
|
||||
GO_VERSION_FILE: ./cmd/manager/version.go
|
||||
IMAGE_NAME: /bsky/feedgen-manager
|
||||
cmds:
|
||||
- docker build -t {{.DOCKER_REGISTRY}}{{.IMAGE_NAME}}:latest -f ./cmd/manager/Dockerfile .
|
||||
- docker push {{.DOCKER_REGISTRY}}{{.IMAGE_NAME}}:latest
|
||||
|
||||
Reference in New Issue
Block a user