From 79f3af99275447058951bc27fc45b669868dde7e Mon Sep 17 00:00:00 2001
From: Francis Lavoie
Date: Wed, 30 Dec 2020 12:54:58 -0500
Subject: [PATCH] ci: Add pushing to cloudsmith (#3941)
* ci: Add pushing to cloudsmith
* ci: Update comments, remove env TODO
* ci: Fix Cloudsmith installation by setting PATH
* docs: Add Cloudsmith attribution to README
* ci: Switch to keeping armv7 as the armhf .deb
---
.github/workflows/release.yml | 55 +++++++++++++++++++++++++++++++++++
README.md | 6 +++-
2 files changed, 60 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index a51a35dde..c09f2379a 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -41,6 +41,9 @@ jobs:
echo "::set-output name=short_sha::$(git rev-parse --short HEAD)"
echo "::set-output name=go_cache::$(go env GOCACHE)"
+ # Add "pip install" CLI tools to PATH
+ echo ~/.local/bin >> $GITHUB_PATH
+
# Parse semver
TAG=${GITHUB_REF/refs\/tags\//}
SEMVER_RE='[^0-9]*\([0-9]*\)[.]\([0-9]*\)[.]\([0-9]*\)\([0-9A-Za-z\.-]*\)'
@@ -53,6 +56,11 @@ jobs:
echo "::set-output name=tag_patch::${TAG_PATCH}"
echo "::set-output name=tag_special::${TAG_SPECIAL}"
+ # Cloudsmith CLI tooling for pushing releases
+ # See https://help.cloudsmith.io/docs/cli
+ - name: Install Cloudsmith CLI
+ run: pip install --upgrade cloudsmith-cli
+
- name: Validate commits and tag signatures
run: |
@@ -82,12 +90,59 @@ jobs:
TAG: ${{ steps.vars.outputs.version_tag }}
# Only publish on non-special tags (e.g. non-beta)
+ # We will continue to push to Gemfury for the forseeable future, although
+ # Cloudsmith is probably better, to not break things for existing users of Gemfury.
+ # See https://gemfury.com/caddy/deb:caddy
- name: Publish .deb to Gemfury
if: ${{ steps.vars.outputs.tag_special == '' }}
env:
GEMFURY_PUSH_TOKEN: ${{ secrets.GEMFURY_PUSH_TOKEN }}
run: |
for filename in dist/*.deb; do
+ # armv6 and armv7 are both "armhf" so we can skip the duplicate
+ if [[ "$filename" == *"armv6"* ]]; then
+ echo "Skipping $filename"
+ continue
+ fi
+
curl -F package=@"$filename" https://${GEMFURY_PUSH_TOKEN}:@push.fury.io/caddy/
done
+ # Publish only special tags (unstable/beta/rc) to the "testing" repo
+ # See https://cloudsmith.io/~caddy/repos/testing/
+ - name: Publish .deb to Cloudsmith (special tags)
+ if: ${{ steps.vars.outputs.tag_special != '' }}
+ env:
+ CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
+ run: |
+ for filename in dist/*.deb; do
+ # armv6 and armv7 are both "armhf" so we can skip the duplicate
+ if [[ "$filename" == *"armv6"* ]]; then
+ echo "Skipping $filename"
+ continue
+ fi
+
+ echo "Pushing $filename to 'testing'"
+ cloudsmith push deb caddy/testing/any-distro/any-version $filename
+ done
+
+ # Publish stable tags to Cloudsmith to both repos, "stable" and "testing"
+ # See https://cloudsmith.io/~caddy/repos/stable/
+ - name: Publish .deb to Cloudsmith (stable tags)
+ if: ${{ steps.vars.outputs.tag_special == '' }}
+ env:
+ CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
+ run: |
+ for filename in dist/*.deb; do
+ # armv6 and armv7 are both "armhf" so we can skip the duplicate
+ if [[ "$filename" == *"armv6"* ]]; then
+ echo "Skipping $filename"
+ continue
+ fi
+
+ echo "Pushing $filename to 'stable'"
+ cloudsmith push deb caddy/stable/any-distro/any-version $filename
+
+ echo "Pushing $filename to 'testing'"
+ cloudsmith push deb caddy/testing/any-distro/any-version $filename
+ done
diff --git a/README.md b/README.md
index 907536538..316a56a95 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,9 @@
+
+
Releases ยท
@@ -187,4 +189,6 @@ Please use our [issue tracker](https://github.com/caddyserver/caddy/issues) only
- _Project on Twitter: [@caddyserver](https://twitter.com/caddyserver)_
- _Author on Twitter: [@mholt6](https://twitter.com/mholt6)_
-Caddy is a project of [ZeroSSL](https://zerossl.com), an [apilayer](https://apilayer.com) company.
\ No newline at end of file
+Caddy is a project of [ZeroSSL](https://zerossl.com), an [apilayer](https://apilayer.com) company.
+
+Debian package repository hosting is graciously provided by [Cloudsmith](https://cloudsmith.com). Cloudsmith is the only fully hosted, cloud-native, universal package management solution, that enables your organization to create, store and share packages in any format, to any place, with total confidence.
\ No newline at end of file