diff --git a/.github/dependabot-cli.yaml b/.github/dependabot-cli.yaml new file mode 100644 index 0000000..ec04896 --- /dev/null +++ b/.github/dependabot-cli.yaml @@ -0,0 +1,16 @@ +job: + package-manager: npm_and_yarn + allowed-updates: + - update-type: all + dependency-groups: + - name: npm-root + rules: + patterns: + - "*" + source: + directories: + - "/" + - "./example" + - "./example-ts" + provider: github + repo: vdaas/vald-client-node diff --git a/.github/workflows/backport-deps.yaml b/.github/workflows/backport-deps.yaml new file mode 100644 index 0000000..42bbae9 --- /dev/null +++ b/.github/workflows/backport-deps.yaml @@ -0,0 +1,26 @@ +# +# Copyright (C) 2019-2024 vdaas.org vald team +# +# 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. +# +name: "Run backport deps update PR" +on: + push: + branches: + - main +jobs: + backport: + uses: vdaas/vald-client-ci/.github/workflows/_backport-deps.yaml@main + secrets: + CI_TOKEN: ${{ secrets.CI_TOKEN }} + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} diff --git a/.github/workflows/pr-auto-merge.yaml b/.github/workflows/pr-auto-merge.yaml new file mode 100644 index 0000000..ebbeeae --- /dev/null +++ b/.github/workflows/pr-auto-merge.yaml @@ -0,0 +1,26 @@ +# +# Copyright (C) 2019-2024 vdaas.org vald team +# +# 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. +# +name: "Run automatically merge bot PR" +on: + pull_request: + +jobs: + auto-merge: + uses: vdaas/vald-client-ci/.github/workflows/_pr-auto-merge.yaml@main + with: + client_type: node + secrets: + CI_TOKEN: ${{ secrets.CI_TOKEN }} diff --git a/.github/workflows/update-deps.yaml b/.github/workflows/update-deps.yaml new file mode 100644 index 0000000..7674ebf --- /dev/null +++ b/.github/workflows/update-deps.yaml @@ -0,0 +1,31 @@ +# +# Copyright (C) 2019-2024 vdaas.org vald team +# +# 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. +# +name: Update npm dependencies + +on: + workflow_dispatch: + schedule: + - cron: "0 12 * * *" +jobs: + update: + uses: vdaas/vald-client-ci/.github/workflows/_update-deps.yaml@main + with: + config_file_path: .github/dependabot-cli.yaml + pr_branch_name: chore/update-npm + secrets: + CI_USER: ${{ secrets.CI_USER }} + CI_TOKEN: ${{ secrets.CI_TOKEN }} + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml deleted file mode 100644 index 32941ae..0000000 --- a/.github/workflows/update.yml +++ /dev/null @@ -1,83 +0,0 @@ -name: Update version -on: - schedule: - - cron: '0 * * * *' - -jobs: - update-version: - name: update-version - runs-on: ubuntu-latest - steps: - - name: Check out code. - uses: actions/checkout@v3 - with: - fetch-depth: 0 - persist-credentials: false - - uses: actions/setup-node@v3 - with: - node-version: '18' - registry-url: 'https://registry.npmjs.org' - - name: Get client version - id: pkg_version - run: | - CURRENT_VERSION=`make vald/client/node/version/print` - PKG_VERSION=`npm show vald-client-node version` - - if [ "$CURRENT_VERSION" != "${PKG_VERSION}" ];then - echo "wait for updated" - exit 0 - fi - - echo "PKG_VERSION=${PKG_VERSION}" >> $GITHUB_OUTPUT - - name: update exmple client package - working-directory: example - run: | - EXAMPLE_PKG_VERSION=`npm list --depth=0 vald-client-node | awk '{print $2}' | grep '@' | xargs -d '@' | xargs -d '\n' | awk '{print $2}'` - - if [ "${PKG_VERSION}" = "${EXAMPLE_PKG_VERSION}" ]; then - echo "noting to do" - exit 0 - fi - - npm install -s vald-client-node@${PKG_VERSION} - npm update - npm outdated - env: - PKG_VERSION: ${{ steps.pkg_version.outputs.PKG_VERSION }} - - name: update exmple-ts client package - working-directory: example-ts - run: | - EXAMPLETS_PKG_VERSION=`npm list --depth=0 vald-client-node | awk '{print $2}' | grep '@' | xargs -d '@' | xargs -d '\n' | awk '{print $2}'` - - if [ "${PKG_VERSION}" = "${EXAMPLETS_PKG_VERSION}" ]; then - echo "nothing to do" - exit 0 - fi - - npm install -s vald-client-node@${PKG_VERSION} - npm update - npm outdated - env: - PKG_VERSION: ${{ steps.pkg_version.outputs.PKG_VERSION }} - - name: Check Changes public - id: git_diff_preview - run: | - diff=`git diff example example-ts` - if [ ! -z "$diff" ] ; then \ - echo "diff=true" >> $GITHUB_OUTPUT - fi - - name: commit update - if: steps.git_diff_preview.outputs.diff - run: | - git config --global user.name "VDaaS org" - git config --global user.email "ci@vdaas.org" - git remote set-url origin https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/$GITHUB_REPOSITORY - - git checkout main - git add example/ example-ts/ - git commit --signoff -m ":arrow_up: update client version ${VERSION}" - - git push origin main - env: - GITHUB_USER: ${{ secrets.VALDCLI_USER }} - GITHUB_TOKEN: ${{ secrets.VALDCLI_TOKEN }}