Skip to content

Commit

Permalink
feat: add reusable workflow for sync repo (#265)
Browse files Browse the repository at this point in the history
Signed-off-by: hlts2 <[email protected]>
  • Loading branch information
hlts2 authored Apr 22, 2024
1 parent a9e9762 commit fa7b81c
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 35 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/_check-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ on:
NEED_UPDATE:
description: "Where it should be updated"
value: ${{ jobs.check-main.outputs.NEED_UPDATE }}
secrets:
CI_TOKEN:
required: true

jobs:
check-main:
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/_check-version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ on:
TAG_DIFF_LIST_JSON_LEN:
description: "JSON value length of tag difference"
value: ${{ jobs.check-version.outputs.TAG_DIFF_LIST_JSON_LEN }}
secrets:
CI_TOKEN:
required: true
env:
VALD_TAG_LIST_API_URL: https://api.github.com/repos/vdaas/vald/tags

Expand Down
7 changes: 0 additions & 7 deletions .github/workflows/_sync-version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@ on:
type: string
default: main
required: false
secrets:
CI_USER:
required: true
CI_TOKEN:
required: true
GPG_PRIVATE_KEY:
required: true

env:
IMAGES: "vdaas/vald-agent-ngt vdaas/vald-discoverer-k8s vdaas/vald-lb-gateway vdaas/vald-manager-index"
Expand Down
7 changes: 0 additions & 7 deletions .github/workflows/_sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ on:
type: boolean
default: false
required: false
secrets:
CI_USER:
required: true
CI_TOKEN:
required: true
GPG_PRIVATE_KEY:
required: true
env:
CI_USER: ${{ secrets.CI_USER }}
CI_TOKEN: ${{ secrets.CI_TOKEN }}
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/client-sync.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
# 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
#
# https://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.
#
# DO NOT EDIT
name: "Sync Vald"
on:
workflow_dispatch:
schedule:
- cron: "*/5 * * * *"
jobs:
sync:
uses: ./.github/workflows/sync.yaml
with:
client_type: python
secrets:
CI_USER: ${{ secrets.DISPATCH_USER }}
CI_TOKEN: ${{ secrets.DISPATCH_TOKEN }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
32 changes: 17 additions & 15 deletions .github/workflows/sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,34 @@
#
name: "Sync Vald"
on:
workflow_dispatch:
# schedule:
# - cron: "*/5 * * * *"
workflow_call:
inputs:
client_type:
type: "string"
description: "Set client type. e.g) go, python, node, java"
required: true
secrets:
CI_USER:
required: true
CI_TOKEN:
required: true
GPG_PRIVATE_KEY:
required: true
jobs:
check-main:
uses: ./.github/workflows/_check-main.yaml
secrets:
CI_TOKEN: ${{ secrets.DISPATCH_TOKEN }}
secrets: inherit

sync-main:
if: ${{ needs.check-main.outputs.NEED_UPDATE == 'true' }}
needs:
- check-main
uses: ./.github/workflows/_sync.yaml
secrets:
CI_USER: ${{ secrets.DISPATCH_USER }}
CI_TOKEN: ${{ secrets.DISPATCH_TOKEN }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
secrets: inherit

check-version:
uses: ./.github/workflows/_check-version.yaml
secrets:
CI_TOKEN: ${{ secrets.DISPATCH_TOKEN }}
secrets: inherit

sync-version:
needs:
Expand All @@ -50,7 +55,4 @@ jobs:
vald_checkout_src_tag_ref: ${{ fromJson(needs.check-version.outputs.TAG_DIFF_LIST_JSON) }}
with:
vald_checkout_src_tag_ref: ${{ matrix.vald_checkout_src_tag_ref }}
secrets:
CI_USER: ${{ secrets.DISPATCH_USER }}
CI_TOKEN: ${{ secrets.DISPATCH_TOKEN }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
secrets: inherit

0 comments on commit fa7b81c

Please sign in to comment.