Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions .github/workflows/bump-sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Bump SDK Version

permissions:
contents: write

on:
workflow_dispatch:
inputs:
version_type:
description: "Version increment type"
required: false
default: "patch"
type: choice
options:
- patch
- minor
- major
- custom
custom_version:
description: "Custom version (if version_type is custom)"
required: false
default: ""
type: string

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "20"

- name: Import GPG Key
run: |
echo "${{ secrets.GPG_KEY }}" | gpg --batch --import
git config --global user.email "[email protected]"
git config --global user.name "GMX Release Bot"
GPG_KEY_ID=$(gpg --list-secret-keys --keyid-format=long | grep '^sec' | tail -1 | awk '{print $2}' | cut -d'/' -f2)
git config --global user.signingkey $GPG_KEY_ID
git config --global gpg.program gpg
git config --global commit.gpgsign true
env:
GPG_KEY: ${{ secrets.GPG_KEY }}

- name: Install dependencies
working-directory: ./sdk
run: yarn install --immutable

- name: Build package
working-directory: ./sdk
run: |
yarn prepare
yarn prebuild
yarn build

- name: Bump version
working-directory: ./sdk
run: |
if [ "${{ github.event.inputs.version_type }}" == "custom" ]; then
if [ -z "${{ github.event.inputs.custom_version }}" ]; then
echo "Custom version not specified"
exit 1
fi
yarn version "${{ github.event.inputs.custom_version }}"
else
yarn version ${{ github.event.inputs.version_type }}
fi

- name: Commit version bump
working-directory: ./sdk
run: |
git add package.json
git commit -S -m "Bump SDK version to $(jq -r .version package.json)"

- name: Push changes
run: |
if [ "${{ github.event.inputs.version_type }}" == "custom" ]; then
exit 0
fi
git push origin HEAD:${{ github.ref_name }}
55 changes: 1 addition & 54 deletions .github/workflows/publish-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,11 @@ permissions:

on:
workflow_dispatch:
inputs:
version_type:
description: "Version increment type"
required: false
default: "patch"
type: choice
options:
- patch
- minor
- major
- custom
custom_version:
description: "Custom version (if version_type is custom)"
required: false
default: ""
type: string

jobs:
publish:
runs-on: ubuntu-latest
environment: sdk_deploy
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -40,18 +25,6 @@ jobs:
scope: "@gmx-io"
auth-token: ${{ secrets.NPM_TOKEN }}

- name: Import GPG Key
run: |
echo "${{ secrets.GPG_KEY }}" | gpg --batch --import
git config --global user.email "[email protected]"
git config --global user.name "GMX Release Bot"
GPG_KEY_ID=$(gpg --list-secret-keys --keyid-format=long | grep '^sec' | tail -1 | awk '{print $2}' | cut -d'/' -f2)
git config --global user.signingkey $GPG_KEY_ID
git config --global gpg.program gpg
git config --global commit.gpgsign true
env:
GPG_KEY: ${{ secrets.GPG_KEY }}

- name: Install dependencies
working-directory: ./sdk
run: yarn install --immutable
Expand All @@ -63,33 +36,7 @@ jobs:
yarn prebuild
yarn build

- name: Bump version
working-directory: ./sdk
run: |
if [ "${{ github.event.inputs.version_type }}" == "custom" ]; then
if [ -z "${{ github.event.inputs.custom_version }}" ]; then
echo "Custom version not specified"
exit 1
fi
yarn version "${{ github.event.inputs.custom_version }}"
else
yarn version ${{ github.event.inputs.version_type }}
fi

- name: Commit version bump
working-directory: ./sdk
run: |
git add package.json
git commit -S -m "Bump SDK version to $(jq -r .version package.json)"

- run: npm publish --access public
working-directory: ./sdk
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Push changes
run: |
if [ "${{ github.event.inputs.version_type }}" == "custom" ]; then
exit 0
fi
git push origin HEAD:${{ github.ref_name }}