Skip to content

release

release #1194

Workflow file for this run

name: release
on:
workflow_dispatch:
inputs:
commit:
description: 'Commit or Tag'
required: false
default: ''
repository_dispatch:
types: [release]
schedule:
- cron: '0 18 */3 * *'
push:
tags:
- 'v*.*.*'
env:
VERSION: ${{ github.sha }}
BUILDER: ${{ secrets.BUILDER }}
KUBECONFIG: ${{ secrets.KUBECONFIG }}
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
SECRET_ID: ${{ secrets.SECRET_ID }}
SECRET_KEY: ${{ secrets.SECRET_KEY }}
REGION: ${{ secrets.REGION }}
CREATE_INSTANCES_PARAM: ${{ secrets.CREATE_INSTANCES_PARAM }}
PASSWORD: ${{ secrets.PASSWORD }}
NEED_DELETE: ${{ secrets.NEED_DELETE }}
DOCKER_HUB_ACTION_AUTH: ${{ secrets.DOCKER_HUB_ACTION_AUTH }}
INSTANCE_TYPES: ${{ secrets.INSTANCE_TYPES }}
DOCKER_PULL_CONFIG: ${{ secrets.DOCKER_PULL_CONFIG }}
jobs:
image:
name: build tke image
runs-on: self-hosted
steps:
- name: Set VERSION
run: |
if ${{github.event_name == 'push'}}; then
echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
elif ${{ github.event.inputs.commit != '' }}; then
echo "VERSION=${{ github.event.inputs.commit }}" >> $GITHUB_ENV
fi
- uses: actions/checkout@v2
with:
ref: ${{ env.VERSION }}
- uses: azure/docker-login@v1
with:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: notify start building release
run: |
(
cat <<EOF
{
"msgtype": "markdown",
"markdown": {
"content": "<font color=\"info\">${{ github.repository }}: Start build release.</font>\n
>version: <font color=\"comment\">$VERSION</font>"
}
}
EOF
) | curl '${{ secrets.WECHATWORK_WEBHOOK }}' \
-H 'Content-Type: application/json' \
-d @-
- name: build release
run: make release.build && make release
- name: notify build release success
if: success()
run: |
(
cat <<EOF
{
"msgtype": "markdown",
"markdown": {
"content": "<font color=\"info\">${{ github.repository }}: Build release success.</font>\n
>version: <font color=\"comment\">$VERSION</font>
"
}
}
EOF
) | curl '${{ secrets.WECHATWORK_WEBHOOK }}' \
-H 'Content-Type: application/json' \
-d @-
- name: notify build release failure
if: failure()
run: |
(
cat <<EOF
{
"msgtype": "markdown",
"markdown": {
"content": "<font color=\"warning\">${{ github.repository }}: Build release failure.</font>\n
>version: <font color=\"comment\">$VERSION</font>
"
}
}
EOF
) | curl '${{ secrets.WECHATWORK_WEBHOOK }}' \
-H 'Content-Type: application/json' \
-d @-
# installer:
# name: installer test
# runs-on: self-hosted
# needs: image
# if: success()
# steps:
# - name: Set VERSION
# run: |
# if ${{github.event_name == 'push'}}; then
# echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
# elif ${{ github.event.inputs.commit != '' }}; then
# echo "VERSION=${{ github.event.inputs.commit }}" >> $GITHUB_ENV
# fi
# - uses: actions/checkout@v2
# with:
# ref: ${{ env.VERSION }}
# - name: Test installer
# run: |
# (
# cat <<EOF
# {
# "msgtype": "markdown",
# "markdown": {
# "content": "<font color=\"info\">${{ github.repository }}: Start test installer.</font>\n
# >version: <font color=\"comment\">$VERSION</font>
# "
# }
# }
# EOF
# ) | curl '${{ secrets.WECHATWORK_WEBHOOK }}' \
# -H 'Content-Type: application/json' \
# -d @-
# ginkgo -nodes=2 -v test/e2e_installer/installer
cluster:
name: cluster test
runs-on: self-hosted
needs: image
if: success()
steps:
- name: Set VERSION
run: |
if ${{github.event_name == 'push'}}; then
echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
elif ${{ github.event.inputs.commit != '' }}; then
echo "VERSION=${{ github.event.inputs.commit }}" >> $GITHUB_ENV
fi
- uses: actions/checkout@v2
with:
ref: ${{ env.VERSION }}
- name: Test cluster
run: |
(
cat <<EOF
{
"msgtype": "markdown",
"markdown": {
"content": "<font color=\"info\">${{ github.repository }}: Start test cluster.</font>\n
>version: <font color=\"comment\">$VERSION</font>
"
}
}
EOF
) | curl '${{ secrets.WECHATWORK_WEBHOOK }}' \
-H 'Content-Type: application/json' \
-d @-
ginkgo -nodes=1 -v test/e2e_installer/cluster
node:
name: node test
runs-on: self-hosted
needs: image
if: success()
steps:
- name: Set VERSION
run: |
if ${{github.event_name == 'push'}}; then
echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
elif ${{ github.event.inputs.commit != '' }}; then
echo "VERSION=${{ github.event.inputs.commit }}" >> $GITHUB_ENV
fi
- uses: actions/checkout@v2
with:
ref: ${{ env.VERSION }}
- name: Test node
run: |
(
cat <<EOF
{
"msgtype": "markdown",
"markdown": {
"content": "<font color=\"info\">${{ github.repository }}: Start test node.</font>\n
>version: <font color=\"comment\">$VERSION</font>
"
}
}
EOF
) | curl '${{ secrets.WECHATWORK_WEBHOOK }}' \
-H 'Content-Type: application/json' \
-d @-
ginkgo -nodes=2 -v test/e2e_installer/node
report-failure:
name: report failure
runs-on: self-hosted
needs: [cluster, node]
if: failure()
steps:
- name: Set VERSION
run: |
if ${{github.event_name == 'push'}}; then
echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
elif ${{ github.event.inputs.commit != '' }}; then
echo "VERSION=${{ github.event.inputs.commit }}" >> $GITHUB_ENV
fi
- name: notify test release failure
run: |
(
cat <<EOF
{
"msgtype": "markdown",
"markdown": {
"content": "<font color=\"info\">${{ github.repository }}: Test release finished.</font>\n
>version: <font color=\"comment\">$VERSION</font>\n
>status: <font color=\"warning\">failure</font>\n
>committer: <font color=\"comment\">${{ github.actor }}</font>\n
"
}
}
EOF
) | curl '${{ secrets.WECHATWORK_WEBHOOK }}' \
-H 'Content-Type: application/json' \
-d @-
report-success:
name: report success
runs-on: self-hosted
needs: [cluster, node]
if: success()
steps:
- name: Set VERSION
run: |
if ${{github.event_name == 'push'}}; then
echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
elif ${{ github.event.inputs.commit != '' }}; then
echo "VERSION=${{ github.event.inputs.commit }}" >> $GITHUB_ENV
fi
- name: notify test release success
run: |
(
cat <<EOF
{
"msgtype": "markdown",
"markdown": {
"content": "<font color=\"info\">${{ github.repository }}: Test release finished.</font>\n
>version: <font color=\"comment\">$VERSION</font>\n
>status: <font color=\"info\">success</font>\n
>committer: <font color=\"comment\">${{ github.actor }}</font>\n
"
}
}
EOF
) | curl '${{ secrets.WECHATWORK_WEBHOOK }}' \
-H 'Content-Type: application/json' \
-d @-