diff --git a/.woodpecker/test.yaml b/.woodpecker/test.yaml new file mode 100644 index 0000000..fb10e2d --- /dev/null +++ b/.woodpecker/test.yaml @@ -0,0 +1,16 @@ +--- +when: + - event: push + branch: feat/woodpecker-ci + +steps: + - name: build + image: debian + commands: + - echo "This is the build step" + - echo "binary-data-123" > executable + - name: a-test-step + image: golang:1.16 + commands: + - echo "Testing ..." + - ./executable diff --git a/scripts/create-nginx-certs.sh b/scripts/create-nginx-certs.sh new file mode 100755 index 0000000..4fb1aed --- /dev/null +++ b/scripts/create-nginx-certs.sh @@ -0,0 +1,103 @@ +#!/usr/bin/env bash + +set -euo pipefail + +usage() { + cat <<'EOF' +Usage: + create-nginx-certs.sh --domain [--output ] + +Options: + -d, --domain Domain name to use for the certificate Common Name and SAN + -o, --output Output file base name (defaults to the domain name) + -h, --help Show this help message + +Examples: + ./create-nginx-certs.sh --domain mydomain.local + ./create-nginx-certs.sh --domain mydomain.local --output foo +EOF +} + +DOMAIN="" +OUTPUT_BASE="" + +while [[ $# -gt 0 ]]; do + case "$1" in + -d|--domain) + if [[ $# -lt 2 ]]; then + echo "Error: --domain requires a value" >&2 + usage >&2 + exit 1 + fi + DOMAIN="$2" + shift 2 + ;; + -o|--output) + if [[ $# -lt 2 ]]; then + echo "Error: --output requires a value" >&2 + usage >&2 + exit 1 + fi + OUTPUT_BASE="$2" + shift 2 + ;; + -h|--help) + usage + exit 0 + ;; + *) + echo "Error: unknown argument: $1" >&2 + usage >&2 + exit 1 + ;; + esac +done + +if [[ -z "$DOMAIN" ]]; then + echo "Error: --domain is required" >&2 + usage >&2 + exit 1 +fi + +if [[ -z "$OUTPUT_BASE" ]]; then + OUTPUT_BASE="$DOMAIN" +fi + +CERT_FILE="${OUTPUT_BASE}.pem" +KEY_FILE="${OUTPUT_BASE}.key.pem" +TMP_CONFIG="$(mktemp)" + +cleanup() { + rm -f "$TMP_CONFIG" +} +trap cleanup EXIT + +cat > "$TMP_CONFIG" <