Add a GitHub action for building nightly images
Signed-off-by: rick <rick@jenkins-zh.cn>
This commit is contained in:
66
.github/workflows/nightly-builds.yml
vendored
Normal file
66
.github/workflows/nightly-builds.yml
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
name: NightlyBuild
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# This is a UTC time
|
||||
- cron: "0 16 * * *"
|
||||
# Keep it only for test purpose, comment it once everything is ok
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GO111MODULE: on
|
||||
steps:
|
||||
|
||||
- name: Set up Go 1.13
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.13
|
||||
id: go
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Downloading go dependencies
|
||||
run: go mod vendor
|
||||
|
||||
- name: Install kubebuilder
|
||||
run: bash hack/install_kubebuilder.sh
|
||||
|
||||
- name: Build
|
||||
run: make all
|
||||
|
||||
- name: Make OpenAPI Spec
|
||||
run: make openapi
|
||||
|
||||
- name: Build and push docker images
|
||||
env:
|
||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||
run: |
|
||||
echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
|
||||
bash hack/docker_build.sh master
|
||||
|
||||
if [[ $? == 0 ]]; then
|
||||
tag=nightly-$(date '+%Y%m%d')
|
||||
|
||||
docker tag kubespheredev/ks-apiserver kubespheredev/ks-apiserver:${tag}
|
||||
docker tag kubespheredev/ks-controller-manager kubespheredev/ks-controller-manager:${tag}
|
||||
|
||||
docker push kubespheredev/ks-apiserver:${tag}
|
||||
docker push kubespheredev/ks-controller-manager:${tag}
|
||||
else
|
||||
exit -1
|
||||
fi
|
||||
|
||||
- name: slack
|
||||
uses: 8398a7/action-slack@v3
|
||||
env:
|
||||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
||||
with:
|
||||
status: ${{ job.status }}
|
||||
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
|
||||
if: always()
|
||||
Reference in New Issue
Block a user