Generate Types #1
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: Generate Types | |
on: | |
workflow_dispatch: | |
jobs: | |
generate-types: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository 📥 | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' # Ensures submodules are also checked out | |
- name: Setup Node.js 🌐 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
cache: 'yarn' | |
- name: Update Git Submodules 🔄 | |
run: | | |
make use-cosmos | |
- name: Install Dependencies 🧶 | |
run: | | |
yarn install | |
yarn symlink | |
- name: Build Project 🏗️ | |
run: | | |
yarn build | |
yarn symlink | |
- name: Types Generation 🛠 | |
run: | | |
# Generate types and interfaces | |
pushd workflows/generate-types | |
yarn generate:types | |
yarn generate:interfaces | |
popd | |
# Build types | |
pushd v2/types | |
yarn build | |
popd | |
# Build interfaces | |
pushd v2/interfaces | |
yarn build | |
popd | |
# Generate and build code for chain registry | |
pushd v2/chain-registry | |
yarn codegen | |
yarn build | |
popd | |
# Stage all changes and commit if there are any changes | |
git config user.name "${{ github.actor }}" | |
git config user.email "${{ github.actor }}@users.noreply.github.com" | |
git add . | |
if ! git diff --staged --quiet; then | |
git commit -am "build 🛠 build-$(date +%Y%m%d-%H%M%S)" | |
git push origin main | |
echo "GIT_RESULT=Published." >> $GITHUB_ENV | |
else | |
echo "GIT_RESULT=No changes to commit." >> $GITHUB_ENV | |
fi | |
- name: Git Ops | |
run: | | |
echo $GIT_RESULT | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_PUBLISH_SECRET}} | |
GH_TOKEN: ${{ secrets.GH_LERNA_PUBLISH_TOKEN }} |