This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch docker
in repository https://gitbox.apache.org/repos/asf/skywalking-eyes.git

commit 7cdfd3c104f226f7c1356f54a6097b705ab7091f
Author: kezhenxu94 <[email protected]>
AuthorDate: Wed Aug 25 11:04:51 2021 +0800

    Publish snapshot Docker image to GHCR
---
 .github/workflows/publish-docker.yaml | 59 +++++++++++++++++++++++++++++++++++
 Makefile                              |  9 ++++--
 README.md                             | 33 ++++++++++++++------
 3 files changed, 90 insertions(+), 11 deletions(-)

diff --git a/.github/workflows/publish-docker.yaml 
b/.github/workflows/publish-docker.yaml
new file mode 100644
index 0000000..b0d13f9
--- /dev/null
+++ b/.github/workflows/publish-docker.yaml
@@ -0,0 +1,59 @@
+# 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:
+      - main
+      - docker
+
+env:
+  HUB: ghcr.io/apache/skywalking-eyes
+
+jobs:
+  build:
+    if: github.repository == 'apache/skywalking-eyes'
+    runs-on: ubuntu-latest
+    permissions:
+      contents: read
+      packages: write
+    timeout-minutes: 30
+    env:
+      VERSION: ${{ github.sha }}
+    steps:
+      - uses: actions/checkout@v2
+        with:
+          submodules: true
+      - uses: actions/cache@v2
+        with:
+          path: |
+            ~/.cache/go-build
+            ~/go/pkg/mod
+          key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
+          restore-keys: ${{ runner.os }}-go-
+      - name: Log in to the Container registry
+        uses: docker/[email protected]
+        with:
+          registry: ${{ env.HUB }}
+          username: ${{ github.actor }}
+          password: ${{ secrets.GITHUB_TOKEN }}
+      - name: Build and push docker image
+        run: |
+          make docker && make docker-push
+          docker tag $HUB/license-eye:$VERSION $HUB/license-eye:latest
+          docker push $HUB/license-eye:latest
diff --git a/Makefile b/Makefile
index b8468b1..06ab602 100644
--- a/Makefile
+++ b/Makefile
@@ -16,6 +16,7 @@
 # under the License.
 #
 
+HUB ?= docker.io/apache
 PROJECT = license-eye
 VERSION ?= latest
 OUT_DIR = bin
@@ -68,7 +69,11 @@ build: windows linux darwin
 
 .PHONY: docker
 docker:
-       docker build . -t $(PROJECT):$(VERSION)
+       docker build . -t $(HUB)/$(PROJECT):$(VERSION)
+
+.PHONY: docker-push
+docker-push:
+       docker push $(HUB)/$(PROJECT):$(VERSION)
 
 .PHONY: clean
 clean:
@@ -120,4 +125,4 @@ verify-docs: docs-gen
                git status -s docs; \
                git diff --color --word-diff --exit-code docs; \
                exit 1; \
-       fi
\ No newline at end of file
+       fi
diff --git a/README.md b/README.md
index effb082..29d2819 100644
--- a/README.md
+++ b/README.md
@@ -49,22 +49,37 @@ header:
 ### Docker Image
 
 ```shell
-$ docker run -it --rm -v $(pwd):/github/workspace apache/skywalking-eyes 
header check
-$ docker run -it --rm -v $(pwd):/github/workspace apache/skywalking-eyes 
header fix
+docker run -it --rm -v $(pwd):/github/workspace apache/skywalking-eyes header 
check
+docker run -it --rm -v $(pwd):/github/workspace apache/skywalking-eyes header 
fix
+```
+
+### Docker Image from latest codes
+
+For users and developers who want to help to test the latest codes on main 
branch, we publish Docker image to GitHub
+Container Registry for every commit in main branch, tagged with the commit 
sha, if it's the latest commit in main
+branch, it's also tagged with `main`.
+
+**Note**: these Docker images are not official Apache releases. For official 
releases, please refer to
+[the download page](https://skywalking.apache.org/downloads/#SkyWalkingEyes) 
for executable binary and
+[the Docker hub](https://hub.docker.com/r/apache/skywalking-eyes) for Docker 
images.
+
+```shell
+docker run -it --rm -v $(pwd):/github/workspace 
ghcr.io/apache/skywalking-eyes/license-eye header check
+docker run -it --rm -v $(pwd):/github/workspace 
ghcr.io/apache/skywalking-eyes/license-eye header fix
 ```
 
 ### Compile from Source
 
 ```bash
-$ git clone https://github.com/apache/skywalking-eyes
-$ cd skywalking-eyes
-$ make build
+git clone https://github.com/apache/skywalking-eyes
+cd skywalking-eyes
+make build
 ```
 
 #### Check License Header
 
 ```bash
-$ bin/darwin/license-eye -c test/testdata/.licenserc_for_test_check.yaml 
header check
+bin/darwin/license-eye -c test/testdata/.licenserc_for_test_check.yaml header 
check
 
 INFO Loading configuration from file: 
test/testdata/.licenserc_for_test_check.yaml 
 INFO Totally checked 30 files, valid: 12, invalid: 12, ignored: 6, fixed: 0 
@@ -87,7 +102,7 @@ exit status 1
 #### Fix License Header
 
 ```bash
-$ bin/darwin/license-eye -c test/testdata/.licenserc_for_test_fix.yaml header 
fix
+bin/darwin/license-eye -c test/testdata/.licenserc_for_test_fix.yaml header fix
 
 INFO Loading configuration from file: 
test/testdata/.licenserc_for_test_fix.yaml
 INFO Totally checked 20 files, valid: 10, invalid: 10, ignored: 0, fixed: 10 
@@ -98,7 +113,7 @@ INFO Totally checked 20 files, valid: 10, invalid: 10, 
ignored: 0, fixed: 10
 This command serves as assistance for human beings to audit the dependencies 
license, it's exit code is always 0.
 
 ```bash
-$ bin/darwin/license-eye -c test/testdata/.licenserc_for_test_check.yaml dep 
resolve
+bin/darwin/license-eye -c test/testdata/.licenserc_for_test_check.yaml dep 
resolve
 INFO GITHUB_TOKEN is not set, license-eye won't comment on the pull request
 INFO Loading configuration from file: 
test/testdata/.licenserc_for_test_check.yaml
 WARNING Failed to resolve the license of dependency: gopkg.in/yaml.v3 cannot 
identify license content
@@ -143,7 +158,7 @@ This command can be used to perform automatic license 
compatibility check, when
 the command will exit with status code 1 and fail the command.
 
 ```bash
-$ bin/darwin/license-eye -c test/testdata/.licenserc_for_test_check.yaml dep 
check
+bin/darwin/license-eye -c test/testdata/.licenserc_for_test_check.yaml dep 
check
 INFO GITHUB_TOKEN is not set, license-eye won't comment on the pull request 
 INFO Loading configuration from file: .licenserc.yaml 
 WARNING Failed to resolve the license of <github.com/gogo/protobuf>: cannot 
identify license content 

Reply via email to