diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..f618317 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,88 @@ +version: 2.1 +jobs: + build: + docker: + - image: circleci/buildpack-deps:latest + steps: + - checkout + - setup_remote_docker + - run: + name: Build Docker image + command: | + docker build --target builder -t letsencrypt-inwx-builder . + docker build -t kegato/letsencrypt-inwx:latest . + - run: + name: Extract Artifacts + command: | + mkdir artifacts + docker save -o image.tar kegato/letsencrypt-inwx:latest + docker create --name builder letsencrypt-inwx-builder + docker cp builder:/home/rust/src/target/x86_64-unknown-linux-musl/release/letsencrypt-inwx . + docker cp builder:/home/rust/src/target/x86_64-unknown-linux-musl/debian . + mv debian/*.deb artifacts/letsencrypt-inwx.deb + zip artifacts/letsencrypt-inwx.zip letsencrypt-inwx + - persist_to_workspace: + root: . + paths: + - ./artifacts + - ./image.tar + + publish-docker-image: + docker: + - image: circleci/buildpack-deps:latest + steps: + - attach_workspace: + at: ./workspace + - setup_remote_docker + - run: + name: Load archived Docker image + command: docker load -i ./workspace/image.tar + - run: + name: Publish Docker Image to Docker Hub + command: | + echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin + docker push kegato/letsencrypt-inwx:latest + + publish-github-release: + docker: + - image: circleci/golang:latest + steps: + - attach_workspace: + at: ./workspace + - run: + name: "Publish Release on GitHub" + command: | + go get github.com/tcnksm/ghr + ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${CIRCLE_TAG} ./workspace/artifacts/ + + publish-crate: + docker: + - image: circleci/rust:latest + steps: + - checkout + - run: + name: "Publish crate to crates.io" + command: | + cargo login ${CRATES_IO_TOKEN} + cargo publish +workflows: + version: 2 + main: + jobs: + - build + - publish-docker-image: + requires: + - build + filters: + tags: + only: /^[0-9]+\.[0-9]+\.[0-9]+$/ + - publish-github-release: + requires: + - build + filters: + tags: + only: /^[0-9]+\.[0-9]+\.[0-9]+$/ + - publish-crate: + filters: + tags: + only: /^[0-9]+\.[0-9]+\.[0-9]+$/ diff --git a/.dockerignore b/.dockerignore index e390dec..a15890a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,7 +1,7 @@ /.vscode /.git /.gitignore -/.travis-yml +/.circleci /target /LICENSE.txt /README.md diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e2a35fb..0000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -sudo: required -services: - - docker -script: - - docker build --target builder -t letsencrypt-inwx-builder . -before_deploy: - - mkdir deploy - - docker create --name letsencrypt-inwx-builder-container letsencrypt-inwx-builder - - docker cp letsencrypt-inwx-builder-container:/home/rust/src/target/x86_64-unknown-linux-musl/release/letsencrypt-inwx deploy/ - - docker cp letsencrypt-inwx-builder-container:/home/rust/src/target/x86_64-unknown-linux-musl/debian deploy/ - - mv deploy/debian/*.deb deploy/ - - rm -rf deploy/debian -deploy: - provider: releases - api_key: - secure: wBWst3ZAaTkTli+9zxdyiursyVkhLbZ9/cuY4FmRzG55k05L7nwJrfdcEgUpDAtAm41oVqzHec7+bmjJ9MVFpMgeNO8ORwEuLA5wxW6qAOlx9nVn7XqKa8OkaBQxszslPFWlhncfn4qYi33eHq/E82Hxl42QZOy7f+mSoQQeXeaXJ/02CQxtwLXR4yxBtTn4auEL2NN89GRLqpW32OPLJZe+NSS4VBMBOfe5MNFUgLNyr1AKlOfcYvk+4nKBHF8dkhpNObOWCU1OmFauPnaeKwQkJOaZ3QiCrpwUmqLaMlZceKE1TVVrRA3IUqlN1KjSLO+mtNVBeka9Z/NnF8YQR49OENI3PY2t2xRvLYXeJN/NVO9EYKemf8GiBvnf9u4beLxpYaEc/d8LjvXLvMq1yY7XZO+NngJadGmcqIYujYo20vRbIzmj4RPXo2gJaDADIraoNPZWzdbsdnoAPgnmmj8jHzCgup9VPkeIaD073BOPSykxFL2V2QRz2R9E7f6UDHmWOYRQvKwVu+rlN3Q6tDPL3m6W6iMrvhQ67YlIEDqd8gIvo1m7OzLfdRG4GhPuTTZXp8YI7ch271LOjTOokLuUVKU2eUe2J6oh85eDGFEBBiRrNvqp8xKBjSRRSjYI9+0SX7mZXDo8KXa9TkqI/wfnqeFmAfAjNzupbu9tFTs= - file_glob: true - file: - - deploy/* - skip_cleanup: true - on: - tags: true diff --git a/README.md b/README.md index 4f60127..721eb13 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# letsencrypt-inwx [![Build Status](https://travis-ci.org/kegato/letsencrypt-inwx.svg?branch=master)](https://travis-ci.org/kegato/letsencrypt-inwx) [![Docker Pulls](https://img.shields.io/docker/pulls/kegato/letsencrypt-inwx.svg)](https://hub.docker.com/r/kegato/letsencrypt-inwx/) [![Crates.io](https://img.shields.io/crates/v/letsencrypt-inwx.svg)](https://crates.io/crates/letsencrypt-inwx) +# letsencrypt-inwx [![Docker Pulls](https://img.shields.io/docker/pulls/kegato/letsencrypt-inwx.svg)](https://hub.docker.com/r/kegato/letsencrypt-inwx/) [![Crates.io](https://img.shields.io/crates/v/letsencrypt-inwx.svg)](https://crates.io/crates/letsencrypt-inwx) A small cli utility for automating the letsencrypt dns-01 challenge for domains hosted by inwx. This allows you to obtain wildcard certificates from letsencrypt.