2021-01-02 22:23:58 +00:00
|
|
|
local pipeline(os, arch) = {
|
2021-01-02 22:22:07 +00:00
|
|
|
kind: "pipeline",
|
2021-01-03 16:03:09 +00:00
|
|
|
name: os + "/" + arch,
|
|
|
|
platform: {
|
|
|
|
"os": os,
|
|
|
|
"arch": arch,
|
|
|
|
},
|
2021-01-02 22:01:44 +00:00
|
|
|
steps: [{
|
2021-01-02 22:20:26 +00:00
|
|
|
name: "compile " + os + "/" + arch,
|
2023-04-28 18:06:57 +00:00
|
|
|
image: "golang:1.20.3-alpine3.17",
|
2021-01-02 22:01:44 +00:00
|
|
|
environment: {
|
|
|
|
"GOOS": os,
|
|
|
|
"GOARCH": arch,
|
|
|
|
"CGO_ENABLED": "0",
|
|
|
|
},
|
|
|
|
commands: [
|
2021-01-02 22:20:26 +00:00
|
|
|
'go build -ldflags "-s -w -X main.version=${DRONE_TAG##v}" -trimpath -o release/' + os + "/" + arch + "/ubnt-freifunk-map-api .",
|
2021-01-02 22:36:27 +00:00
|
|
|
"tar -cvzf release/ubnt-freifunk-map-api_"+ os + "-" + arch + ".tar.gz -C release/" + os + "/" + arch + " ubnt-freifunk-map-api"
|
2021-01-02 22:01:44 +00:00
|
|
|
],
|
|
|
|
},
|
2021-01-02 22:42:19 +00:00
|
|
|
{
|
|
|
|
name: "gitea_release " + os + "/" + arch,
|
|
|
|
image: "plugins/gitea-release",
|
|
|
|
settings: {
|
2021-01-02 23:22:14 +00:00
|
|
|
api_key: { "from_secret": "gitea_api_key" },
|
2021-01-02 22:42:19 +00:00
|
|
|
base_url: "https://git.freifunk-rhein-sieg.net",
|
|
|
|
files: "release/*.tar.gz"
|
|
|
|
},
|
|
|
|
when: {
|
|
|
|
event: "tag"
|
|
|
|
},
|
|
|
|
},
|
2021-01-02 23:39:50 +00:00
|
|
|
{
|
|
|
|
name: "upload to docker hub " + os + "/" + arch,
|
2021-01-03 00:28:54 +00:00
|
|
|
image: "plugins/docker:" + os + "-" + arch,
|
2021-01-02 23:39:50 +00:00
|
|
|
settings: {
|
2023-04-28 19:34:22 +00:00
|
|
|
repo: "git.freifunk-rhein-sieg.net/freifunk-froisdorf/ubnt-freifunk-map-api",
|
2023-04-28 19:51:32 +00:00
|
|
|
registry: git.freifunk-rhein-sieg.net
|
2021-01-02 23:39:50 +00:00
|
|
|
username: { "from_secret": "docker_username" },
|
|
|
|
password: { "from_secret": "docker_password" },
|
|
|
|
auto_tag: true,
|
2021-01-03 16:03:09 +00:00
|
|
|
auto_tag_suffix: os + "-" + arch
|
2021-01-02 23:39:50 +00:00
|
|
|
},
|
|
|
|
when: {
|
|
|
|
event: "tag"
|
|
|
|
},
|
|
|
|
},
|
2021-01-02 22:01:44 +00:00
|
|
|
],
|
|
|
|
};
|
2021-01-02 23:19:39 +00:00
|
|
|
|
2021-01-03 16:03:09 +00:00
|
|
|
local manifest() = {
|
|
|
|
kind: "pipeline",
|
|
|
|
type: "docker",
|
|
|
|
name: "manifest",
|
2021-01-03 16:14:23 +00:00
|
|
|
depends_on: ["linux/amd64"],
|
2021-01-03 16:03:09 +00:00
|
|
|
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" },
|
|
|
|
},
|
2021-01-03 16:17:51 +00:00
|
|
|
when: {
|
|
|
|
event: "tag"
|
|
|
|
},
|
2021-01-03 16:03:09 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
2021-02-13 16:43:13 +00:00
|
|
|
local validateJSON() = {
|
2021-02-06 16:57:09 +00:00
|
|
|
kind: "pipeline",
|
|
|
|
type: "docker",
|
|
|
|
name: "validate json",
|
|
|
|
when: {
|
|
|
|
event: "push"
|
|
|
|
},
|
|
|
|
|
|
|
|
steps: [
|
|
|
|
{
|
|
|
|
name: "validate ucDevices",
|
|
|
|
image: "fftdf/docker-json-validate",
|
2021-02-06 16:59:05 +00:00
|
|
|
commands: [
|
|
|
|
"jsonlint ucDevices.json"
|
|
|
|
],
|
2021-02-06 16:57:09 +00:00
|
|
|
when: {
|
|
|
|
event: "push"
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "validate Devices",
|
|
|
|
image: "fftdf/docker-json-validate",
|
2021-02-06 16:59:05 +00:00
|
|
|
commands: [
|
|
|
|
"jsonlint devices.json",
|
|
|
|
],
|
2021-02-06 16:57:09 +00:00
|
|
|
when: {
|
|
|
|
event: "push"
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
2021-01-02 22:01:44 +00:00
|
|
|
[
|
|
|
|
pipeline("linux", "amd64"),
|
2021-01-03 16:14:23 +00:00
|
|
|
// pipeline("linux", "arm64"),
|
2021-01-03 16:03:09 +00:00
|
|
|
manifest()
|
2021-01-02 22:16:14 +00:00
|
|
|
]
|