From da8ff84fd31df166b7867b20b288f73a01eed739 Mon Sep 17 00:00:00 2001 From: Ian Fijolek Date: Fri, 8 Jan 2021 16:45:30 -0500 Subject: [PATCH] Add publish pipeline --- .drone.yml | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ .gitignore | 2 ++ mage_fake_env.sh | 14 +++++++++++++ 3 files changed, 67 insertions(+) create mode 100755 mage_fake_env.sh diff --git a/.drone.yml b/.drone.yml index 45ebf43..3d9d26f 100644 --- a/.drone.yml +++ b/.drone.yml @@ -6,12 +6,63 @@ steps: - name: check image: iamthefij/drone-pre-commit:personal +--- +kind: pipeline +name: publish + +depends_on: + - test + +trigger: + event: + - push + - tag + refs: + - refs/heads/master + - refs/tags/v* + +steps: + - name: submodules + image: alpine/git + commands: + - git submodule init + - git submodule update --recursive --remote + + - name: build + image: golang:1.15 + commands: + - apt-get update + - apt-get install -y --no-install-recommends libpcsclite-dev + # Download and install mage + - (cd $GOPATH && go get -u -d github.com/magefile/mage) + - (cd $GOPATH/src/github.com/magefile/mage && go run bootstrap.go) + # Build distribution bundle + - ./mage_fake_env.sh dist + + - name: gitea release + image: plugins/gitea-release + settings: + title: ${DRONE_TAG} + files: dist/* + checksum: + - md5 + - sha1 + - sha256 + - sha512 + base_url: + from_secret: gitea_base_url + api_key: + from_secret: gitea_token + when: + event: tag + --- kind: pipeline name: notify depends_on: - test + - publish trigger: status: diff --git a/.gitignore b/.gitignore index c9ec3f8..e82177e 100644 --- a/.gitignore +++ b/.gitignore @@ -74,3 +74,5 @@ src/vendor/ src/libusb-1.0.dylib *.pyc venv +static-builder +fake_alfred_home/ diff --git a/mage_fake_env.sh b/mage_fake_env.sh new file mode 100755 index 0000000..97d623f --- /dev/null +++ b/mage_fake_env.sh @@ -0,0 +1,14 @@ +#! /bin/bash + +# Statically compile the builder +mage -compile ./static-builder + +# Change the environment to one that looks kinda like Alfred +export HOME=fake_alfred_home +alfred_sync_dir="$HOME/Library/Application Support/Alfred" +mkdir -p "$alfred_sync_dir/Alfred.alfredpreferences/workflows" +echo '{"syncfolders": {"4": "/dev/null"}, "current": "/dev/null"}' > "$alfred_sync_dir/prefs.json" +# Run the builder with whatever arguments +export GOOS=darwin +export GOARCH=amd64 +./static-builder "$@"