forked from meshery/meshery
-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (100 loc) · 4.04 KB
/
build-and-release-dde.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Docker Extension for Meshery
on:
workflow_call:
# push:
# tags:
# - "v*"
workflow_dispatch:
inputs:
release-ver:
description: "Stable Release Version"
required: true
default: "v"
stripped-release-ver:
description: "Stripped Stable Release Version"
required: true
default: ""
release-channel:
description: "Release Channel"
required: true
default: "edge"
env:
GIT_VERSION: ${{github.event.inputs.release-ver}}
GIT_STRIPPED_VERSION: ${{github.event.inputs.stripped-release-ver}}
RELEASE_CHANNEL: ${{github.event.inputs.release-channel}}
GIT_TAG: ${{ github.event.release.tag_name }}
jobs:
print-inputs:
runs-on: ubuntu-22.04
steps:
- run: |
echo "Dispatched GIT_VERSION: ${{github.event.inputs.release-ver}}"
echo " Dispatched GIT_STRIPPED_VERSION: ${{github.event.inputs.stripped-release-ver}}"
echo "Env RELEASE_CHANNEL: ${{env.RELEASE_CHANNEL}}"
echo "Env GIT_VERSION: ${{env.GIT_VERSION}}"
echo "Env GIT_STRIPPED_VERSION: ${{env.GIT_STRIPPED_VERSION}}"
echo "Env GIT_TAG: ${{ github.event.release.tag_name }}"
docker-extension:
runs-on: ubuntu-22.04
steps:
- name: Checkout 🛎️ repo
uses: actions/checkout@master
- name: Identify Release Values
if: "${{ github.event.inputs.release-ver}} != 'v' }}"
run: |
# GIT_TAG=`git symbolic-ref HEAD`
if [[ ${GITHUB_REF} = refs/tags* ]]
then
echo RELEASE_CHANNEL=stable >> $GITHUB_ENV
else
echo RELEASE_CHANNEL=edge >> $GITHUB_ENV
fi
LATEST_VERSION=$(git ls-remote --sort='v:refname' --tags | tail -1 | cut -f2 | sed 's/refs\/tags\///g') >> $GITHUB_ENV
GIT_VERSION=$(git ls-remote --sort='v:refname' --tags | tail -1 | cut -f2 | sed 's/refs\/tags\///g') >> $GITHUB_ENV
GIT_STRIPPED_VERSION=$(git ls-remote --sort='v:refname' --tags | tail -1 | cut -f2 | sed 's/refs\/tags\///g' | cut -c2-)
echo "Release channel determined to be $RELEASE_CHANNEL"
echo "GIT_LATEST=$LATEST_VERSION" >> $GITHUB_ENV
echo "GIT_VERSION=$GIT_VERSION" >> $GITHUB_ENV
echo "GIT_STRIPPED_VERSION=$GIT_STRIPPED_VERSION" >> $GITHUB_ENV
shell: bash
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker Meta
id: meta
uses: docker/metadata-action@v3
with:
images: meshery/docker-extension-meshery
flavor: |
latest=true
tags: |
type=raw,value=${{env.RELEASE_CHANNEL}}-{{sha}}
type=semver,pattern={{version}},value=${{env.GIT_STRIPPED_VERSION}}
type=raw,value=${{env.RELEASE_CHANNEL}}-{{tag}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
type=raw,value=${{env.RELEASE_CHANNEL}}-latest
type=raw,value=${{env.RELEASE_CHANNEL}}-${{env.GIT_VERSION}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and Push
uses: docker/build-push-action@v2
with:
context: "{{defaultContext}}:install/docker-extension"
push: true
build-args: |
GIT_STRIPPED_VERSION=${{env.GIT_STRIPPED_VERSION}}
GIT_VERSION=${{env.GIT_VERSION}}
RELEASE_CHANNEL=${{env.RELEASE_CHANNEL}}
tags: ${{ steps.meta.outputs.tags }}
platforms: linux/amd64,linux/arm64
# -
# name: Docker Hub Description
# uses: peter-evans/dockerhub-description@v3
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
# repository: meshery/meshery-docker-extension
# readme-filepath: /install/docker-extension/README.md