Skip to content

Commit

Permalink
add sdk auto-bump
Browse files Browse the repository at this point in the history
  • Loading branch information
NourAlharithi committed Feb 8, 2024
1 parent b11cd8c commit f2ba035
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/on-sdk-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Deploy on sdk update
on:
push:
branches:
- master
repository_dispatch:
types: [sdk-update]

jobs:
update-sdk:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup node
uses: actions/setup-node@v2
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'

- name: Determine sdk version
id: determine-sdk-version
run: |
if [[ "${{ github.event_name }}" == "repository_dispatch" ]]; then
echo "SDK_VERSION=${{ github.event.client_payload.version }}" >> $GITHUB_ENV
else
# Get the current version of sdk used in package.json
CURRENT_VERSION=$(node -e "console.log(require('./package.json').dependencies['@drift-labs/sdk'])")
echo "SDK_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
fi
- name: Install dependencies
run: yarn

- name: Add specific version of sdk
run: yarn add @drift-labs/sdk@$SDK_VERSION

- run: yarn build

- name: Update package version
run: npm version patch

- name: Git commit
run: |
VERSION=$(node -e "console.log(require('./package.json').version);")
git config user.name "GitHub Actions"
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git add -A
git commit --allow-empty -m "sdk: release v$VERSION"
git push origin HEAD

0 comments on commit f2ba035

Please sign in to comment.