Skip to content

Commit

Permalink
add release.yml and push-images.sh to push mapper images to dockerhub…
Browse files Browse the repository at this point in the history
… when release is published

Signed-off-by: Ryan <[email protected]>
  • Loading branch information
RyanZhaoXB committed Jan 18, 2023
1 parent 1a172d8 commit ac64a52
Show file tree
Hide file tree
Showing 8 changed files with 122 additions and 6 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

name: Build Mapper and Publish Docker Image to DockerHub

on:
release:
types: [published]

jobs:
push-docker-image-to-dockerhub:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.17.x

- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}

- name: Install dependences
run: sudo apt-get update && sudo apt-get install -y upx-ucl gcc-aarch64-linux-gnu libc6-dev-arm64-cross gcc-arm-linux-gnueabi libc6-dev-armel-cross libva-dev libva-drm2 libx11-dev libvdpau-dev libxext-dev libsdl1.2-dev libxcb1-dev libxau-dev libxdmcp-dev yasm

- name: Install ffmpeg
run: sudo curl -sLO https://ffmpeg.org/releases/ffmpeg-4.1.6.tar.bz2 && tar -jx --strip-components=1 -f ffmpeg-4.1.6.tar.bz2 && ./configure && make && sudo make install

- name: Install golangci-lint
run: curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.39.0

- name: Check out the repo
uses: actions/checkout@v3

- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build Docker image
env:
IMAGE_REPO_NAME: kubeedge
run: make all package ${{ github.ref_name }}

- name: Push ble Mapper Image
run: bash ./hack/make-rules/push-images.sh ble ${{ github.ref_name }} linux-amd64 ${{ env.IMAGE_REPO_NAME }}
- name: Push modbus Mapper Image
run: bash hack/make-rules/push-images.sh modbus ${{ github.ref_name }} linux-amd64 ${{ env.IMAGE_REPO_NAME }}
- name: Push opcua Mapper Image
run: bash hack/make-rules/push-images.sh opcua ${{ github.ref_name }} linux-amd64 ${{ env.IMAGE_REPO_NAME }}
- name: Push onvif Mapper Image
run: bash hack/make-rules/push-images.sh onvif ${{ github.ref_name }} linux-amd64 ${{ env.IMAGE_REPO_NAME }}
- name: Push gige Mapper Image
run: bash hack/make-rules/push-images.sh gige ${{ github.ref_name }} linux-amd64 ${{ env.IMAGE_REPO_NAME }}
28 changes: 28 additions & 0 deletions hack/make-rules/push-images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

###
#Copyright 2021 The KubeEdge Authors.
#
#Licensed 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.
###

set -o errexit
set -o nounset
set -o pipefail

# $1: name of mapper
# $2: version of mapper
# $3: architecture of mapper
# $4: repository of dockerhub
docker tag "$1-mapper:$2-$3" "$4/$1-mapper:$2-$3"
docker push "$4/$1-mapper:$2-$3"
7 changes: 6 additions & 1 deletion mappers/ble/hack/make-rules/mapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ function package() {
echo "packaging mapper ${mapper}..."

local image_name="${mapper}-mapper"
local tag=v1.0

if [[ -n "$2" ]]; then
local tag=$2
else
local tag=v1.0
fi

local platform
if [[ "${ARM:-false}" == "true" ]]; then
Expand Down
6 changes: 5 additions & 1 deletion mappers/gige/hack/make-rules/mapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ function package() {
echo "packaging mapper ${mapper}..."

local image_name="${mapper}-mapper"
local tag=v1.0
if [[ -n "$2" ]]; then
local tag=$2
else
local tag=v1.0
fi

local platform
if [[ "${ARM:-false}" == "true" ]]; then
Expand Down
6 changes: 5 additions & 1 deletion mappers/modbus-dmi/hack/make-rules/mapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ function package() {
echo "packaging mapper ${mapper}..."

local image_name="${mapper}-mapper"
local tag=v1.0
if [[ -n "$2" ]]; then
local tag=$2
else
local tag=v1.0
fi

local platform
if [[ "${ARM:-false}" == "true" ]]; then
Expand Down
6 changes: 5 additions & 1 deletion mappers/modbus/hack/make-rules/mapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ function package() {
echo "packaging mapper ${mapper}..."

local image_name="${mapper}-mapper"
local tag=v1.0
if [[ -n "$2" ]]; then
local tag=$2
else
local tag=v1.0
fi

local platform
if [[ "${ARM:-false}" == "true" ]]; then
Expand Down
6 changes: 5 additions & 1 deletion mappers/onvif/hack/make-rules/mapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ function package() {
echo "packaging mapper ${mapper}..."

local image_name="${mapper}-mapper"
local tag=v1.0
if [[ -n "$2" ]]; then
local tag=$2
else
local tag=v1.0
fi

local platform
if [[ "${ARM:-false}" == "true" ]]; then
Expand Down
6 changes: 5 additions & 1 deletion mappers/opcua/hack/make-rules/mapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ function package() {
echo "packaging mapper ${mapper}..."

local image_name="${mapper}-mapper"
local tag=v1.0
if [[ -n "$2" ]]; then
local tag=$2
else
local tag=v1.0
fi

local platform
if [[ "${ARM:-false}" == "true" ]]; then
Expand Down

0 comments on commit ac64a52

Please sign in to comment.