Skip to content

Commit

Permalink
- [+] publishing to central cloudsmith repo
Browse files Browse the repository at this point in the history
  • Loading branch information
suntong committed Dec 18, 2021
1 parent 7c48239 commit ed1b03f
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/go-release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ jobs:
with:
go-version: 1.15

-
name: Install Cloudsmith CLI
run: pip install --upgrade cloudsmith-cli
# Cloudsmith CLI tooling for pushing releases
# See https://help.cloudsmith.io/docs/cli

-
name: Checkout
uses: actions/checkout@v2
Expand All @@ -43,3 +49,31 @@ jobs:
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Publish to cloudsmith repo
-
name: Publish package to cloudsmith
if: success() && startsWith(github.ref, 'refs/tags/')
env:
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
run: |
for filepath in dist/*; do
echo "== Analyzing '$filepath' for publishing"
filename=$(basename -- "$filepath")
extension="${filename##*.}"
filename="${filename%.*}"
case "$extension" in
'apk')
echo "Pushing '$filepath' to cloudsmith repo"
cloudsmith push alpine suntong/repo/alpine/any-version $filepath
;;
'deb' | 'rpm')
echo "Pushing '$filepath' to cloudsmith repo"
cloudsmith push $extension suntong/repo/any-distro/any-version $filepath
;;
*)
echo "File .$extension skipped publishing"
echo
;;
esac
done

0 comments on commit ed1b03f

Please sign in to comment.