diff --git a/.github/workflows/generate.yaml b/.github/workflows/generate.yaml new file mode 100644 index 00000000..5e51e274 --- /dev/null +++ b/.github/workflows/generate.yaml @@ -0,0 +1,33 @@ +name: Injective Docs Generation + +jobs: + generate: + runs-on: ubuntu-latest + steps: + - name: Checkout injective-docs + uses: actions/checkout@v1 + with: + repository: InjectiveLabs/injective-docs + ref: dev + path: ./injective-docs + + - name: Generate new docs from injective-core + run: | + cd injective-docs + export GH_CORE_USER=${{ secrets.GH_CORE_USER }} + export GH_CORE_TOKEN=${{ secrets.GH_CORE_TOKEN }} + ./scripts/setup.sh + + - name: Checkout injective-docs + uses: actions/checkout@v1 + with: + repository: InjectiveLabs/injective-docs + ref: dev + path: ./injective-docs + + - name: Commit the changes to injective-docs + run: | + cd injective-docs + git add . + git commit -m "chore: docs regenerated" + git push diff --git a/scripts/setup.sh b/scripts/setup.sh index 28fc5a2d..0af6c95c 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -12,7 +12,12 @@ rm -rf $INJECTIVE_DIR mkdir $CORE_DIR mkdir $INJECTIVE_DIR -git clone https://github.com/InjectiveLabs/injective-core.git $BUILD_DIR/injective-core -b $injective_core_branch --depth 1 --single-branch > /dev/null +if [ -f "$GH_CORE_USER" ] && [ -f "$GH_CORE_TOKEN" ]; then + git clone https://$GH_CORE_USER:$GH_CORE_TOKEN@github.com/InjectiveLabs/injective-core.git $BUILD_DIR/injective-core -b $injective_core_branch --depth 1 --single-branch > /dev/null +else + git clone https://github.com/InjectiveLabs/injective-core.git $BUILD_DIR/injective-core -b $injective_core_branch --depth 1 --single-branch > /dev/null +fi + git clone https://github.com/InjectiveLabs/cosmos-sdk.git $BUILD_DIR/cosmos-sdk -b $cosmos_sdk_branch --depth 1 --single-branch > /dev/null for D in ./$BUILD_DIR/cosmos-sdk/x/*; do