Skip to content

Commit 0ae3a57

Browse files
committed
- [+] add publishing to cloudsmith github workflow
1 parent 5f91e94 commit 0ae3a57

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

.github/workflows/go-release-build.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ jobs:
1717
with:
1818
go-version: 1.15
1919

20+
-
21+
name: Install Cloudsmith CLI
22+
run: pip install --upgrade cloudsmith-cli
23+
# Cloudsmith CLI tooling for pushing releases
24+
# See https://help.cloudsmith.io/docs/cli
25+
2026
-
2127
name: Checkout
2228
uses: actions/checkout@v2
@@ -43,3 +49,31 @@ jobs:
4349
args: release --rm-dist
4450
env:
4551
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
53+
# Publish to cloudsmith repo
54+
-
55+
name: Publish package to cloudsmith
56+
if: success() && startsWith(github.ref, 'refs/tags/')
57+
env:
58+
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
59+
run: |
60+
for filepath in dist/*; do
61+
echo "== Analyzing '$filepath' for publishing"
62+
filename=$(basename -- "$filepath")
63+
extension="${filename##*.}"
64+
filename="${filename%.*}"
65+
case "$extension" in
66+
'apk')
67+
echo "Pushing '$filepath' to cloudsmith repo"
68+
cloudsmith push alpine suntong/repo/alpine/any-version $filepath
69+
;;
70+
'deb' | 'rpm')
71+
echo "Pushing '$filepath' to cloudsmith repo"
72+
cloudsmith push $extension suntong/repo/any-distro/any-version $filepath
73+
;;
74+
*)
75+
echo "File .$extension skipped publishing"
76+
echo
77+
;;
78+
esac
79+
done

0 commit comments

Comments
 (0)