Publish Docker snapshot images to ghcr (#116)
diff --git a/.github/workflows/publish-docker.yaml b/.github/workflows/publish-docker.yaml
new file mode 100644
index 0000000..a987c85
--- /dev/null
+++ b/.github/workflows/publish-docker.yaml
@@ -0,0 +1,53 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+name: publish-docker
+
+on:
+ push:
+ branches:
+ - master
+
+env:
+ SKIP_TEST: true
+ HUB: ghcr.io/apache/skywalking-cli
+
+jobs:
+ build:
+ if: github.repository == 'apache/skywalking-cli'
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ packages: write
+ timeout-minutes: 30
+ env:
+ VERSION: ${{ github.sha }}
+ APP_NAME: skywalking-cli
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ submodules: true
+ - name: Log in to the Container registry
+ uses: docker/login-action@v1.10.0
+ with:
+ registry: ${{ env.HUB }}
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+ - name: Build docker image
+ run: |
+ make docker.push || make docker.push
+ docker tag $HUB/$APP_NAME:{$VERSION,latest}
+ docker push $HUB/$APP_NAME:latest
diff --git a/Dockerfile b/Dockerfile
index 264a581..5f9f4a4 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+ARG VERSION
+
FROM golang:1.14 AS builder
ENV CGO_ENABLED=0
diff --git a/Makefile b/Makefile
index bd19b36..a31fde4 100644
--- a/Makefile
+++ b/Makefile
@@ -69,7 +69,7 @@
&& cd ..
.PHONY: $(PLATFORMS)
-$(PLATFORMS):
+$(PLATFORMS): clean
mkdir -p $(OUT_DIR)
GOOS=$(os) GOARCH=$(ARCH) $(GO_BUILD) $(GO_BUILD_FLAGS) -ldflags "$(GO_BUILD_LDFLAGS)" -o $(OUT_DIR)/$(BINARY)-$(VERSION)-$(os)-$(ARCH) cmd/swctl/main.go
@@ -150,7 +150,11 @@
.PHONY: docker
docker:
- docker build . -t $(HUB)/$(APP_NAME):$(VERSION)
+ docker build --build-arg VERSION=$(VERSION) . -t $(HUB)/$(APP_NAME):$(VERSION)
+
+.PHONY: docker.push
+docker.push: docker
+ docker push $(HUB)/$(APP_NAME):$(VERSION)
.PHONY: test-commands
test-commands:
diff --git a/README.md b/README.md
index c6cef7e..9e6cb67 100644
--- a/README.md
+++ b/README.md
@@ -49,6 +49,20 @@
You can also copy it to any directory you like, then add that directory to `PATH`. **We recommend you to rename the `swctl-latest-(darwin|linux|windows)-amd64` to `swctl`.**
+### Run from Docker image
+
+If you prefer to use Docker, skywalking-cli also provides Docker images for convenient usages since 0.9.0.
+We also push the snapshot Docker images to GitHub registry for developers who want to test the latest features,
+note that this is not Apache releases, and it's for test only, **DO NOT** use it in your production environment.
+
+```shell
+docker run -it --rm apache/skywalking-cli service ls
+
+# Or to use the snapshot Docker image
+
+docker run -it --rm ghcr.io/apache/skywalking-cli/skywalking-cli service ls
+```
+
## Autocompletion
`swctl` provides auto-completion support for bash and powershell, which can save you a lot of typing.
diff --git a/docs/How-to-release.md b/docs/How-to-release.md
index 127e42a..bb42c55 100644
--- a/docs/How-to-release.md
+++ b/docs/How-to-release.md
@@ -185,10 +185,15 @@
1. Move source codes tar balls and distributions to `https://dist.apache.org/repos/dist/release/skywalking/`, **you can do this only if you are a PMC member**.
```shell
- export SVN_EDITOR=vim
- svn mv https://dist.apache.org/repos/dist/dev/skywalking/cli/$VERSION https://dist.apache.org/repos/dist/release/skywalking/cli
+ svn mv https://dist.apache.org/repos/dist/dev/skywalking/cli/$VERSION https://dist.apache.org/repos/dist/release/skywalking/cli -m"Release SkyWalking CLI $VERSION"
```
-
+
+1. Push Docker images.
+
+```shell
+make docker.push
+```
+
1. Refer to the previous [PR](https://github.com/apache/skywalking-website/pull/212), update the event and download links on the website.
1. Update [Github release page](https://github.com/apache/skywalking-cli/releases), follow the previous convention.