mfm/.drone.yml

67 lines
1.9 KiB
YAML
Raw Permalink Normal View History

2023-10-25 12:11:28 +00:00
---
kind: pipeline
type: docker
name: default
steps:
- name: build:binary
image: crystallang/crystal:1.7.3
2023-10-25 12:28:54 +00:00
environment:
PACKAGE_BASENAME: mfm_linux_amd64
2023-10-25 12:11:28 +00:00
volumes:
- name: cache
path: /_cache
commands:
- pwd
2023-10-25 12:28:54 +00:00
- apt-get update &&
apt-get install -y cmake g++ libevent-dev libpcre3-dev libyaml-dev
2023-10-25 12:11:28 +00:00
- shards install
- shards build --production --static
2023-10-25 12:18:07 +00:00
- strip bin/mfm
2023-10-25 12:11:28 +00:00
- mkdir -p /_cache/bin
2023-10-25 12:28:54 +00:00
- cp -r bin/mfm /_cache/bin/$PACKAGE_BASENAME
2023-10-25 12:11:28 +00:00
- name: publish:tag
image: curlimages/curl
environment:
PACKAGE_UPLOAD_URL: https://code.apps.glenux.net/api/packages/glenux/generic/mfm
RELEASES_URL: https://code.apps.glenux.net/api/repos/glenux/releases
2023-10-25 12:18:07 +00:00
PACKAGE_BASENAME: mfm_linux_amd64
2023-10-25 12:11:28 +00:00
PACKAGE_UPLOAD_TOKEN:
from_secret: PACKAGE_UPLOAD_TOKEN
when:
ref:
include:
- refs/tags/**
volumes:
- name: cache
path: /_cache
commands:
- env |grep DRONE
- |
curl -H "Authorization: token $PACKAGE_UPLOAD_TOKEN" \
--upload-file "/_cache/bin/$PACKAGE_BASENAME" \
"$PACKAGE_UPLOAD_URL/$DRONE_TAG/$PACKAGE_BASENAME"
- |
curl -H "Authorization: token $PACKAGE_UPLOAD_TOKEN" \
-X POST \
-H "accept: application/json" \
-H "content-type: application/json" \
-d "{\"tag_name\": \"$DRONE_TAG\", \"target_commitish\": \"$DRONE_COMMIT_SHA\"}" \
$RELEASES_URL
- |
curl -H "Authorization: token $PACKAGE_UPLOAD_TOKEN" \
-H "accept: application/json" \
-H "Content-Type: multipart/form-data" \
--upload-file "attachment=@/_cache/bin/$PACKAGE_BASENAME" \
"$RELEASES_URL/$DRONE_TAG/assets?name=$PACKAGE_BASENAME"
2023-10-25 12:11:28 +00:00
# FIXME: handle multi-arch
# FIXME: publish only on tags
volumes:
- name: cache
temp: {}
#