All checks were successful
continuous-integration/drone/push Build is passing
438 lines
12 KiB
YAML
438 lines
12 KiB
YAML
---
|
|
kind: pipeline
|
|
type: docker
|
|
name: build-amd64
|
|
|
|
platform:
|
|
os: linux
|
|
arch: amd64
|
|
|
|
steps:
|
|
- name: generate go and OpenAPI files
|
|
image: golang:1-alpine
|
|
commands:
|
|
- sed -i '/npm run build/d;/npm run generate:api/d' web/assets.go web-admin/assets.go
|
|
- go install github.com/swaggo/swag/cmd/swag@latest
|
|
- go generate ./...
|
|
|
|
- name: update frontend version
|
|
image: node:24-alpine
|
|
commands:
|
|
- cd web && npm version "${DRONE_TAG##v}" --no-git-tag-version --allow-same-version
|
|
when:
|
|
event:
|
|
- tag
|
|
|
|
- name: frontend
|
|
image: node:24-alpine
|
|
commands:
|
|
- apk --no-cache add tar
|
|
- yarn config set network-timeout 100000
|
|
- yarn install
|
|
- tar --transform="s@.@./happydomain-${DRONE_COMMIT}@" --exclude-vcs --exclude=./node_modules/.cache --exclude=./web/node_modules/.cache --exclude=./web-admin/node_modules/.cache -czf /dev/shm/happydomain-src.tar.gz ./package.json ./package-lock.json ./.npmrc ./node_modules/ ./web/ ./web-admin/
|
|
- mkdir deploy
|
|
- mv /dev/shm/happydomain-src.tar.gz deploy
|
|
- yarn --cwd web --offline run svelte-kit sync && yarn --cwd web --offline generate:api && sed -i "s/hey-api\.ts';/hey-api';/" web/src/lib/api-base/client.gen.ts
|
|
- yarn --cwd web --offline build
|
|
- yarn --cwd web-admin --offline run svelte-kit sync && yarn --cwd web-admin --offline generate:api && sed -i "s/hey-api\.ts';/hey-api';/" web/src/lib/api-admin/client.gen.ts
|
|
- yarn --cwd web-admin --offline build
|
|
|
|
- name: frontend NOTICE
|
|
image: node:24-alpine
|
|
commands:
|
|
- npx --yes generate-license-file@3 --input web/package.json --output deploy/NOTICE.web --ci
|
|
- npx --yes generate-license-file@3 --input web-admin/package.json --output deploy/NOTICE.web-admin --ci
|
|
- for f in deploy/NOTICE.web deploy/NOTICE.web-admin; do { echo '------'; tail -n +3 "$f"; } > "$f.tmp" && mv "$f.tmp" "$f"; done
|
|
when:
|
|
event:
|
|
- tag
|
|
|
|
- name: backend-commit
|
|
image: golang:1-alpine
|
|
commands:
|
|
- apk add --no-cache git
|
|
- go build -ldflags '-w -X "main.Version=${DRONE_BRANCH}-${DRONE_COMMIT}" -X main.build=${DRONE_BUILD_NUMBER}' -o deploy/happydomain-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} ./cmd/happyDomain/
|
|
- ln deploy/happydomain-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} happydomain
|
|
environment:
|
|
CGO_ENABLED: 0
|
|
GOFLAGS: "-tags=netgo,swagger,web"
|
|
when:
|
|
event:
|
|
exclude:
|
|
- tag
|
|
|
|
- name: backend-tag
|
|
image: golang:1-alpine
|
|
commands:
|
|
- apk add --no-cache git
|
|
- go build -ldflags '-w -X main.Version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}' -o deploy/happydomain-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} ./cmd/happyDomain/
|
|
- ln deploy/happydomain-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} happydomain
|
|
# Generate NOTICE file (merging Go + frontend)
|
|
- go install github.com/google/go-licenses@v1.6.0
|
|
- go-licenses report ./cmd/happyDomain --template .drone-notice.tpl > deploy/NOTICE.go
|
|
- cat deploy/NOTICE.go deploy/NOTICE.web deploy/NOTICE.web-admin > deploy/NOTICE
|
|
- rm deploy/NOTICE.go deploy/NOTICE.web deploy/NOTICE.web-admin
|
|
environment:
|
|
CGO_ENABLED: 0
|
|
GOFLAGS: "-tags=netgo,swagger,web"
|
|
when:
|
|
event:
|
|
- tag
|
|
|
|
- name: generate SBOM
|
|
image: nemunaire/drone-syft
|
|
settings:
|
|
select_catalogers: go,npm
|
|
output: spdx-json=deploy/happydomain-sbom.spdx.json
|
|
source_name: happyDomain
|
|
|
|
- name: build-commit macOS
|
|
image: golang:1-alpine
|
|
commands:
|
|
- apk add --no-cache git
|
|
- go build -tags netgo,swagger,web -ldflags '-w -X "main.Version=${DRONE_BRANCH}-${DRONE_COMMIT}" -X main.build=${DRONE_BUILD_NUMBER}' -o deploy/happydomain-darwin-${DRONE_STAGE_ARCH} ./cmd/happyDomain/
|
|
environment:
|
|
CGO_ENABLED: 0
|
|
GOOS: darwin
|
|
GOARCH: amd64
|
|
when:
|
|
event:
|
|
exclude:
|
|
- tag
|
|
|
|
- name: build-tag macOS
|
|
image: golang:1-alpine
|
|
commands:
|
|
- apk add --no-cache git
|
|
- go build -tags netgo,swagger,web -ldflags '-w -X "main.Version=${DRONE_TAG##v}" -X main.build=${DRONE_BUILD_NUMBER}' -o deploy/happydomain-darwin-${DRONE_STAGE_ARCH} ./cmd/happyDomain/
|
|
environment:
|
|
CGO_ENABLED: 0
|
|
GOOS: darwin
|
|
GOARCH: amd64
|
|
when:
|
|
event:
|
|
- tag
|
|
|
|
- name: deploy
|
|
image: plugins/s3
|
|
settings:
|
|
endpoint: https://blob.nemunai.re
|
|
path_style: true
|
|
region: garage
|
|
bucket: happydomain-dl
|
|
access_key:
|
|
from_secret: s3_access_key
|
|
secret_key:
|
|
from_secret: s3_secret_key
|
|
source: deploy/*
|
|
target: /${DRONE_BRANCH//\//-}/
|
|
strip_prefix: deploy/
|
|
when:
|
|
event:
|
|
- push
|
|
branch:
|
|
exclude:
|
|
- renovate/*
|
|
|
|
- name: deploy release
|
|
image: plugins/s3
|
|
settings:
|
|
endpoint: https://blob.nemunai.re
|
|
path_style: true
|
|
region: garage
|
|
bucket: happydomain-dl
|
|
access_key:
|
|
from_secret: s3_access_key
|
|
secret_key:
|
|
from_secret: s3_secret_key
|
|
source: deploy/*
|
|
target: /${DRONE_TAG}/
|
|
strip_prefix: deploy/
|
|
when:
|
|
event:
|
|
- tag
|
|
|
|
- name: publish on Docker Hub
|
|
image: plugins/docker
|
|
settings:
|
|
repo: happydomain/happydomain
|
|
auto_tag: true
|
|
auto_tag_suffix: ${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}
|
|
dockerfile: Dockerfile-builded
|
|
username:
|
|
from_secret: docker_username
|
|
password:
|
|
from_secret: docker_password
|
|
|
|
- name: publish release on gitea
|
|
image: plugins/gitea-release
|
|
settings:
|
|
api_key:
|
|
from_secret: git_nemunaire_token
|
|
base_url: https://git.nemunai.re
|
|
draft: true
|
|
files: deploy/*
|
|
when:
|
|
event:
|
|
- tag
|
|
|
|
- name: publish release on codeberg
|
|
image: plugins/gitea-release
|
|
settings:
|
|
api_key:
|
|
from_secret: codeberg_token
|
|
base_url: https://codeberg.org
|
|
draft: true
|
|
files: deploy/*
|
|
when:
|
|
event:
|
|
- tag
|
|
|
|
- name: publish release on github
|
|
image: plugins/github-release
|
|
settings:
|
|
api_key:
|
|
from_secret: github_release_token
|
|
draft: true
|
|
github_url: https://github.com
|
|
files: deploy/*
|
|
when:
|
|
event:
|
|
- tag
|
|
|
|
trigger:
|
|
branch:
|
|
exclude:
|
|
- renovate/*
|
|
event:
|
|
- cron
|
|
- push
|
|
- tag
|
|
|
|
---
|
|
kind: pipeline
|
|
type: docker
|
|
name: build-arm64
|
|
|
|
platform:
|
|
os: linux
|
|
arch: arm64
|
|
|
|
steps:
|
|
- name: generate go and OpenAPI files
|
|
image: golang:1-alpine
|
|
commands:
|
|
- sed -i '/npm run build/d;/npm run generate:api/d' web/assets.go web-admin/assets.go
|
|
- go install github.com/swaggo/swag/cmd/swag@latest
|
|
- go generate ./...
|
|
|
|
- name: update frontend version
|
|
image: node:24-alpine
|
|
commands:
|
|
- cd web && npm version "${DRONE_TAG##v}" --no-git-tag-version --allow-same-version
|
|
when:
|
|
event:
|
|
- tag
|
|
|
|
- name: frontend
|
|
image: node:24-alpine
|
|
commands:
|
|
- npm install --network-timeout=100000
|
|
- cd web
|
|
- npx svelte-kit sync && npm run generate:api
|
|
- npm test
|
|
- npm run build
|
|
- cd ../web-admin
|
|
- npx svelte-kit sync && npm run generate:api
|
|
- npm test
|
|
- npm run build
|
|
|
|
- name: backend-commit
|
|
image: golang:1-alpine
|
|
commands:
|
|
- apk add --no-cache git
|
|
- go build -tags netgo,swagger,web -ldflags '-w -X "main.Version=${DRONE_BRANCH}-${DRONE_COMMIT}" -X main.build=${DRONE_BUILD_NUMBER}' -o deploy/happydomain-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} ./cmd/happyDomain/
|
|
- ln deploy/happydomain-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} happydomain
|
|
environment:
|
|
CGO_ENABLED: 0
|
|
when:
|
|
event:
|
|
exclude:
|
|
- tag
|
|
|
|
- name: backend-tag
|
|
image: golang:1-alpine
|
|
commands:
|
|
- apk add --no-cache git
|
|
- go build -tags netgo,swagger,web -ldflags '-w -X main.Version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}' -o deploy/happydomain-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} ./cmd/happyDomain/
|
|
- ln deploy/happydomain-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} happydomain
|
|
environment:
|
|
CGO_ENABLED: 0
|
|
when:
|
|
event:
|
|
- tag
|
|
|
|
- name: vet and tests
|
|
image: golang:1-alpine
|
|
commands:
|
|
- apk --no-cache add build-base git
|
|
- go vet ./...
|
|
- go test ./...
|
|
environment:
|
|
CGO_ENABLED: 0
|
|
|
|
- name: build-commit macOS
|
|
image: golang:1-alpine
|
|
commands:
|
|
- apk add --no-cache git
|
|
- go build -tags netgo,swagger,web -ldflags '-w -X "main.Version=${DRONE_BRANCH}-${DRONE_COMMIT}" -X main.build=${DRONE_BUILD_NUMBER}' -o deploy/happydomain-darwin-${DRONE_STAGE_ARCH} ./cmd/happyDomain/
|
|
environment:
|
|
CGO_ENABLED: 0
|
|
GOOS: darwin
|
|
GOARCH: arm64
|
|
when:
|
|
event:
|
|
exclude:
|
|
- tag
|
|
|
|
- name: build-tag macOS
|
|
image: golang:1-alpine
|
|
commands:
|
|
- apk add --no-cache git
|
|
- go build -tags netgo,swagger,web -ldflags '-w -X "main.Version=${DRONE_TAG##v}" -X main.build=${DRONE_BUILD_NUMBER}' -o deploy/happydomain-darwin-${DRONE_STAGE_ARCH} ./cmd/happyDomain/
|
|
environment:
|
|
CGO_ENABLED: 0
|
|
GOOS: darwin
|
|
GOARCH: arm64
|
|
when:
|
|
event:
|
|
- tag
|
|
|
|
- name: deploy
|
|
image: plugins/s3
|
|
settings:
|
|
endpoint: https://blob.nemunai.re
|
|
path_style: true
|
|
region: garage
|
|
bucket: happydomain-dl
|
|
access_key:
|
|
from_secret: s3_access_key
|
|
secret_key:
|
|
from_secret: s3_secret_key
|
|
source: deploy/*
|
|
target: /${DRONE_BRANCH//\//-}/
|
|
strip_prefix: deploy/
|
|
when:
|
|
event:
|
|
- push
|
|
branch:
|
|
exclude:
|
|
- renovate/*
|
|
|
|
- name: deploy release
|
|
image: plugins/s3
|
|
settings:
|
|
endpoint: https://blob.nemunai.re
|
|
path_style: true
|
|
region: garage
|
|
bucket: happydomain-dl
|
|
access_key:
|
|
from_secret: s3_access_key
|
|
secret_key:
|
|
from_secret: s3_secret_key
|
|
source: deploy/*
|
|
target: /${DRONE_TAG}/
|
|
strip_prefix: deploy/
|
|
when:
|
|
event:
|
|
- tag
|
|
|
|
- name: publish on Docker Hub
|
|
image: plugins/docker
|
|
settings:
|
|
repo: happydomain/happydomain
|
|
auto_tag: true
|
|
auto_tag_suffix: ${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}
|
|
dockerfile: Dockerfile-builded
|
|
username:
|
|
from_secret: docker_username
|
|
password:
|
|
from_secret: docker_password
|
|
|
|
- name: publish release on gitea
|
|
image: plugins/gitea-release
|
|
settings:
|
|
api_key:
|
|
from_secret: git_nemunaire_token
|
|
base_url: https://git.nemunai.re
|
|
draft: true
|
|
prerelease: true
|
|
files: deploy/*
|
|
when:
|
|
event:
|
|
- tag
|
|
|
|
- name: publish release on codeberg
|
|
image: plugins/gitea-release
|
|
settings:
|
|
api_key:
|
|
from_secret: codeberg_token
|
|
base_url: https://codeberg.org
|
|
draft: true
|
|
prerelease: true
|
|
files: deploy/*
|
|
when:
|
|
event:
|
|
- tag
|
|
|
|
- name: publish release on github
|
|
image: plugins/github-release
|
|
settings:
|
|
api_key:
|
|
from_secret: github_release_token
|
|
draft: true
|
|
prerelease: true
|
|
github_url: https://github.com
|
|
files: deploy/*
|
|
when:
|
|
event:
|
|
- tag
|
|
|
|
trigger:
|
|
event:
|
|
- cron
|
|
- push
|
|
- tag
|
|
|
|
---
|
|
kind: pipeline
|
|
name: docker-manifest
|
|
|
|
platform:
|
|
os: linux
|
|
arch: arm64
|
|
|
|
steps:
|
|
- name: publish on Docker Hub
|
|
image: plugins/manifest
|
|
settings:
|
|
auto_tag: true
|
|
ignore_missing: true
|
|
spec: .drone-manifest.yml
|
|
username:
|
|
from_secret: docker_username
|
|
password:
|
|
from_secret: docker_password
|
|
|
|
trigger:
|
|
branch:
|
|
exclude:
|
|
- renovate/*
|
|
event:
|
|
- cron
|
|
- push
|
|
- tag
|
|
|
|
depends_on:
|
|
- build-amd64
|
|
- build-arm64
|