Skip to content

Commit

Permalink
Update nightly-build workflow (#794)
Browse files Browse the repository at this point in the history
* Update nightly-build workflow

Signed-off-by: chengleqi <leqicheng@stu.xidian.edu.cn>

* Fix redundant DockerHub credential issue

Signed-off-by: chengleqi <leqicheng@stu.xidian.edu.cn>

* Check GHCR_TOKEN before NightBuild jobs start

Signed-off-by: chengleqi <leqicheng@stu.xidian.edu.cn>

Signed-off-by: chengleqi <leqicheng@stu.xidian.edu.cn>
  • Loading branch information
chengleqi committed Aug 23, 2022
1 parent 9208f96 commit 9367e7a
Showing 1 changed file with 63 additions and 18 deletions.
81 changes: 63 additions & 18 deletions .github/workflows/nightly-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,25 @@ on:
workflow_dispatch:

jobs:
check:
runs-on: ubuntu-20.04
outputs:
status: ${{ steps.early.outputs.status}}
steps:
- name: Early exit
id: early
run: |
if [ "${{ secrets.GHCR_TOKEN }}" != "" ]
then
echo "::set-output name=status::success"
else
echo "::set-output name=status::fail"
fi
BuildController:
needs:
- check
if: needs.check.outputs.status == 'success'
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
Expand All @@ -19,7 +37,7 @@ jobs:
with:
images: |
kubespheredev/devops-controller
ghcr.io/${{ github.repository_owner }}/devops-controller
ghcr.io/kubesphere-sigs/devops-controller
tags: |
type=schedule,pattern=nightly-{{date 'YYYYMMDD'}}
type=raw,enable=true,value=nightly-{{date 'YYYYMMDD'}}
Expand All @@ -38,13 +56,20 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
if: github.event_name != 'pull_request'
if: github.repository_owner == 'kubesphere'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_SECRETS }}
- name: Login to GHCR
if: github.event_name != 'pull_request'
if: github.repository_owner == 'kubesphere'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: kubesphere-sigs
password: ${{ secrets.GHCR_TOKEN }}
- name: login to GHCR for Contributors
if: github.repository_owner != 'kubesphere'
uses: docker/login-action@v1
with:
registry: ghcr.io
Expand All @@ -56,20 +81,23 @@ jobs:
with:
file: config/dockerfiles/controller-manager/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
push: ${{ github.event_name != 'pull_request' }}
push: true
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
- name: Build and push Docker images for Contributors
uses: docker/build-push-action@v2.4.0
if: github.repository_owner != 'kubesphere'
if: github.repository_owner != 'kubesphere'
with:
file: config/dockerfiles/controller-manager/Dockerfile
tags: ${{ steps.metaContributors.outputs.tags }}
push: ${{ github.event_name != 'pull_request' }}
push: true
labels: ${{ steps.metaContributors.outputs.labels }}
platforms: linux/amd64,linux/arm64

BuildAPIServer:
needs:
- check
if: needs.check.outputs.status == 'success'
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
Expand All @@ -80,7 +108,7 @@ jobs:
with:
images: |
kubespheredev/devops-apiserver
ghcr.io/${{ github.repository_owner }}/devops-apiserver
ghcr.io/kubesphere-sigs/devops-apiserver
tags: |
type=schedule,pattern=nightly-{{date 'YYYYMMDD'}}
type=raw,enable=true,value=nightly-{{date 'YYYYMMDD'}}
Expand All @@ -99,13 +127,20 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
if: github.event_name != 'pull_request'
if: github.repository_owner == 'kubesphere'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_SECRETS }}
- name: Login to GHCR
if: github.event_name != 'pull_request'
if: github.repository_owner == 'kubesphere'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: kubesphere-sigs
password: ${{ secrets.GHCR_TOKEN }}
- name: login to GHCR for Contributors
if: github.repository_owner != 'kubesphere'
uses: docker/login-action@v1
with:
registry: ghcr.io
Expand All @@ -117,20 +152,23 @@ jobs:
with:
file: config/dockerfiles/apiserver/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
push: ${{ github.event_name != 'pull_request' }}
push: true
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
- name: Build and push Docker images for Contributors
uses: docker/build-push-action@v2.4.0
if: github.repository_owner != 'kubesphere'
if: github.repository_owner != 'kubesphere'
with:
file: config/dockerfiles/apiserver/Dockerfile
tags: ${{ steps.metaContributors.outputs.tags }}
push: ${{ github.event_name != 'pull_request' }}
push: true
labels: ${{ steps.metaContributors.outputs.labels }}
platforms: linux/amd64,linux/arm64

BuildTools:
needs:
- check
if: needs.check.outputs.status == 'success'
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
Expand All @@ -141,7 +179,7 @@ jobs:
with:
images: |
kubespheredev/devops-tools
ghcr.io/${{ github.repository_owner }}/devops-tools
ghcr.io/kubesphere-sigs/devops-tools
tags: |
type=schedule,pattern=nightly-{{date 'YYYYMMDD'}}
type=raw,enable=true,value=nightly-{{date 'YYYYMMDD'}}
Expand All @@ -160,13 +198,20 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
if: github.event_name != 'pull_request'
if: github.repository_owner == 'kubesphere'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_SECRETS }}
- name: Login to GHCR
if: github.event_name != 'pull_request'
if: github.repository_owner == 'kubesphere'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: kubesphere-sigs
password: ${{ secrets.GHCR_TOKEN }}
- name: login to GHCR for Contributors
if: github.repository_owner != 'kubesphere'
uses: docker/login-action@v1
with:
registry: ghcr.io
Expand All @@ -178,15 +223,15 @@ jobs:
with:
file: config/dockerfiles/tools/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
push: ${{ github.event_name != 'pull_request' }}
push: true
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
- name: Build and push Docker images for Contributors
uses: docker/build-push-action@v2.4.0
if: github.repository_owner != 'kubesphere'
if: github.repository_owner != 'kubesphere'
with:
file: config/dockerfiles/tools/Dockerfile
tags: ${{ steps.metaContributors.outputs.tags }}
push: ${{ github.event_name != 'pull_request' }}
push: true
labels: ${{ steps.metaContributors.outputs.labels }}
platforms: linux/amd64,linux/arm64

0 comments on commit 9367e7a

Please sign in to comment.