Update DevCycle SDKs to Latest #216
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update DevCycle SDKs to Latest | |
on: | |
schedule: | |
- cron: '0 12 * * *' | |
workflow_dispatch: | |
jobs: | |
update-dvc: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '22.x' | |
cache: 'yarn' | |
- name: Set Git author | |
shell: bash | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "DevCycle Automation" | |
- name: Set branch name | |
shell: bash | |
run: echo "BRANCH_NAME=update-dvc-sdk" >> $GITHUB_ENV | |
- name: Update DevCycle SDKs to latest | |
run: yarn add @devcycle/types | |
- name: Update node proxy SDK to latest | |
working-directory: proxies/nodejs | |
run: yarn add @devcycle/nodejs-server-sdk | |
- name: update OF node proxy SDKs to latest | |
working-directory: proxies/openfeature-nodejs | |
run: yarn add @devcycle/nodejs-server-sdk @openfeature/server-sdk @openfeature/core | |
- name: Check for changes to package.json | |
shell: bash | |
run: | | |
IS_UPDATED=$(git diff --name-only origin/main package.json proxies/nodejs/package.json proxies/openfeature-nodejs/package.json | wc -l) | |
if [ "$IS_UPDATED" -gt "0" ]; then | |
echo "IS_UPDATED=true" >> $GITHUB_ENV | |
else | |
echo "IS_UPDATED=false" >> $GITHUB_ENV | |
fi | |
- name: Check if branch already exists | |
run: echo "BRANCH_EXISTS=$(git branch -a | grep $BRANCH_NAME)" >> $GITHUB_ENV | |
- name: Commit & push changes | |
if: ${{ env.IS_UPDATED && !env.BRANCH_EXISTS }} | |
shell: bash | |
run: | | |
git checkout -b "$BRANCH_NAME" | |
git add package.json | |
git add yarn.lock | |
git commit -m "Update DevCycle SDKs to latest" | |
git push --set-upstream origin "$BRANCH_NAME" | |
- name: Create Pull Request | |
if: ${{ env.IS_UPDATED && !env.BRANCH_EXISTS }} | |
shell: bash | |
env: | |
GH_TOKEN: ${{ secrets.AUTOMATION_USER_TOKEN }} | |
run: | | |
gh pr create \ | |
--base main --head "$BRANCH_NAME" \ | |
--title "chore(deps): Update DevCycle SDKs to latest" \ | |
--body "This PR is auto generated by this [github workflow](https://github.com/${{ github.repository }}/actions/workflows/update-dvc-sdk.yml)" \ | |
--reviewer DevCycleHQ/engineering |