113 lines
2.4 KiB
Plaintext
113 lines
2.4 KiB
Plaintext
local pipeline(os, arch) = {
|
|
kind: "pipeline",
|
|
name: os + "/" + arch,
|
|
platform: {
|
|
"os": os,
|
|
"arch": arch,
|
|
},
|
|
steps: [{
|
|
name: "compile " + os + "/" + arch,
|
|
image: "golang:1.20.3-alpine3.17",
|
|
environment: {
|
|
"GOOS": os,
|
|
"GOARCH": arch,
|
|
"CGO_ENABLED": "0",
|
|
},
|
|
commands: [
|
|
'go build -ldflags "-s -w -X main.version=${DRONE_TAG##v}" -trimpath -o release/' + os + "/" + arch + "/ubnt-freifunk-map-api .",
|
|
"tar -cvzf release/ubnt-freifunk-map-api_"+ os + "-" + arch + ".tar.gz -C release/" + os + "/" + arch + " ubnt-freifunk-map-api"
|
|
],
|
|
},
|
|
{
|
|
name: "gitea_release " + os + "/" + arch,
|
|
image: "plugins/gitea-release",
|
|
settings: {
|
|
api_key: { "from_secret": "gitea_api_key" },
|
|
base_url: "https://git.freifunk-rhein-sieg.net",
|
|
files: "release/*.tar.gz"
|
|
},
|
|
when: {
|
|
event: "tag"
|
|
},
|
|
},
|
|
{
|
|
name: "upload to docker hub " + os + "/" + arch,
|
|
image: "plugins/docker:" + os + "-" + arch,
|
|
settings: {
|
|
repo: "fftdf/ffmap-ubnt-api",
|
|
username: { "from_secret": "docker_username" },
|
|
password: { "from_secret": "docker_password" },
|
|
auto_tag: true,
|
|
auto_tag_suffix: os + "-" + arch
|
|
},
|
|
when: {
|
|
event: "tag"
|
|
},
|
|
},
|
|
],
|
|
};
|
|
|
|
local manifest() = {
|
|
kind: "pipeline",
|
|
type: "docker",
|
|
name: "manifest",
|
|
depends_on: ["linux/amd64"],
|
|
when: {
|
|
event: "tag"
|
|
},
|
|
|
|
steps: [
|
|
{
|
|
name: "publish",
|
|
image: "plugins/manifest",
|
|
settings: {
|
|
auto_tag: true,
|
|
ignore_missing: true,
|
|
spec: "manifest.yml",
|
|
username: { "from_secret": "docker_username" },
|
|
password: { "from_secret": "docker_password" },
|
|
},
|
|
when: {
|
|
event: "tag"
|
|
},
|
|
},
|
|
],
|
|
};
|
|
|
|
local validateJSON() = {
|
|
kind: "pipeline",
|
|
type: "docker",
|
|
name: "validate json",
|
|
when: {
|
|
event: "push"
|
|
},
|
|
|
|
steps: [
|
|
{
|
|
name: "validate ucDevices",
|
|
image: "fftdf/docker-json-validate",
|
|
commands: [
|
|
"jsonlint ucDevices.json"
|
|
],
|
|
when: {
|
|
event: "push"
|
|
},
|
|
},
|
|
{
|
|
name: "validate Devices",
|
|
image: "fftdf/docker-json-validate",
|
|
commands: [
|
|
"jsonlint devices.json",
|
|
],
|
|
when: {
|
|
event: "push"
|
|
},
|
|
},
|
|
],
|
|
};
|
|
|
|
[
|
|
pipeline("linux", "amd64"),
|
|
// pipeline("linux", "arm64"),
|
|
manifest()
|
|
] |