Skip to content

Commit

Permalink
Merge pull request #21 from mangata-finance/chore/fix-automation-types
Browse files Browse the repository at this point in the history
chore: update ci automation
  • Loading branch information
devdanco authored Feb 26, 2024
2 parents d1200b7 + fef0cce commit 56a64cd
Showing 1 changed file with 19 additions and 24 deletions.
43 changes: 19 additions & 24 deletions .github/workflows/pr-automation-types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,11 @@ on:
type: string
required: true
default: "mangatasolutions/mangata-node:develop"
branchPreRelease:
branch:
description: "Branch for pre-release"
type: string
required: true
default: ""
branchMangataNode:
description: "Branch for mangata-node"
type: string
required: true
default: "develop"


concurrency: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -49,7 +44,7 @@ jobs:
- name: NPM version bump type definitions
working-directory: packages/type-definitions
env:
INPUTS_BRANCH: ${{ github.event.inputs.branchPreRelease }}
INPUTS_BRANCH: ${{ github.event.inputs.branch }}
run: |
# Branch name sanitization added to avoid issues with npm version command
# Example `ci/new-branch-1.0.0` -> `ci-new-branch-1-0-0`
Expand All @@ -61,8 +56,8 @@ jobs:
git config user.email [email protected]
git add .
git commit -m "chore: updated type definitions to new prerelease version"
git pull origin ${{ github.event.inputs.branchPreRelease }} --rebase
git push origin ${{ github.event.inputs.branchPreRelease }}
git pull origin ${{ github.event.inputs.branch }} --rebase
git push origin ${{ github.event.inputs.branch }}
- name: Build type definitions
run: npx nx run @mangata-finance/type-definitions:build
Expand All @@ -71,7 +66,7 @@ jobs:
working-directory: dist/packages/type-definitions
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
INPUTS_BRANCH: ${{ github.event.inputs.branchPreRelease }}
INPUTS_BRANCH: ${{ github.event.inputs.branch }}
run: |
echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc
Expand All @@ -92,7 +87,7 @@ jobs:
with:
repository: mangata-finance/mangata-node
path: mangata-repo
ref: ${{ github.event.inputs.branchMangataNode }}
ref: ${{ github.event.inputs.branch }}

- name: Setup Node version and cache dependencies
uses: actions/setup-node@v3
Expand Down Expand Up @@ -146,7 +141,7 @@ jobs:
- name: NPM version bump
working-directory: packages/types
env:
INPUTS_BRANCH: ${{ github.event.inputs.branchPreRelease }}
INPUTS_BRANCH: ${{ github.event.inputs.branch }}
run: |
# Branch name sanitization added to avoid issues with npm version command
# Example `ci/new-branch-1.0.0` -> `ci-new-branch-1-0-0`
Expand All @@ -164,8 +159,8 @@ jobs:
git config user.email [email protected]
git add .
git commit -m "chore: updated types to new prerelease version"
git pull origin ${{ github.event.inputs.branchPreRelease }} --rebase
git push origin ${{ github.event.inputs.branchPreRelease }}
git pull origin ${{ github.event.inputs.branch }} --rebase
git push origin ${{ github.event.inputs.branch }}
- name: Build types
run: npx nx run @mangata-finance/types:build
Expand All @@ -174,7 +169,7 @@ jobs:
working-directory: dist/packages/types
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
INPUTS_BRANCH: ${{ github.event.inputs.branchPreRelease }}
INPUTS_BRANCH: ${{ github.event.inputs.branch }}
run: |
echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc
Expand All @@ -198,12 +193,12 @@ jobs:

- name: Type definitions version for branch
run: |
branchTypeDefinitionsVersion=$(npm show @mangata-finance/type-definitions dist-tags."$(echo "${{ github.event.inputs.branchPreRelease }}" | sed -E 's@[/\.]@-@g; s@_@-@g')")
branchTypeDefinitionsVersion=$(npm show @mangata-finance/type-definitions dist-tags."$(echo "${{ github.event.inputs.branch }}" | sed -E 's@[/\.]@-@g; s@_@-@g')")
echo "BRANCH_TYPE_DEFINITIONS_VERSION=$branchTypeDefinitionsVersion" >> $GITHUB_ENV
- name: Types version for branch
run: |
branchTypesVersion=$(npm show @mangata-finance/types dist-tags."$(echo "${{ github.event.inputs.branchPreRelease }}" | sed -E 's@[/\.]@-@g; s@_@-@g')")
branchTypesVersion=$(npm show @mangata-finance/types dist-tags."$(echo "${{ github.event.inputs.branch }}" | sed -E 's@[/\.]@-@g; s@_@-@g')")
echo "BRANCH_TYPES_VERSION=$branchTypesVersion" >> $GITHUB_ENV
- name: Update types dependency version
Expand All @@ -227,7 +222,7 @@ jobs:
- name: NPM version bump
working-directory: packages/sdk
env:
INPUTS_BRANCH: ${{ github.event.inputs.branchPreRelease }}
INPUTS_BRANCH: ${{ github.event.inputs.branch }}
run: |
# Branch name sanitization added to avoid issues with npm version command
# Example `ci/new-branch-1.0.0` -> `ci-new-branch-1-0-0`
Expand All @@ -239,8 +234,8 @@ jobs:
git config user.email [email protected]
git add .
git commit -m "chore: updated sdk to new prerelease version"
git pull origin ${{ github.event.inputs.branchPreRelease }} --rebase
git push origin ${{ github.event.inputs.branchPreRelease }}
git pull origin ${{ github.event.inputs.branch }} --rebase
git push origin ${{ github.event.inputs.branch }}
- name: Build sdk
run: npx nx run @mangata-finance/sdk:build
Expand All @@ -249,7 +244,7 @@ jobs:
working-directory: dist/packages/sdk
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
INPUTS_BRANCH: ${{ github.event.inputs.branchPreRelease }}
INPUTS_BRANCH: ${{ github.event.inputs.branch }}
run: |
echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc
Expand All @@ -260,10 +255,10 @@ jobs:
- name: Show released versions
run: |
echo "Version of @mangata-finance/type-definitions:"
npm show @mangata-finance/type-definitions dist-tags."$(echo "${{ github.event.inputs.branchPreRelease }}" | sed -E 's@[/\.]@-@g; s@_@-@g')"
npm show @mangata-finance/type-definitions dist-tags."$(echo "${{ github.event.inputs.branch }}" | sed -E 's@[/\.]@-@g; s@_@-@g')"
echo "Version of @mangata-finance/types:"
npm show @mangata-finance/types dist-tags."$(echo "${{ github.event.inputs.branchPreRelease }}" | sed -E 's@[/\.]@-@g; s@_@-@g')"
npm show @mangata-finance/types dist-tags."$(echo "${{ github.event.inputs.branch }}" | sed -E 's@[/\.]@-@g; s@_@-@g')"
echo "Version of @mangata-finance/sdk:"
npm show @mangata-finance/sdk dist-tags."$(echo "${{ github.event.inputs.branchPreRelease }}" | sed -E 's@[/\.]@-@g; s@_@-@g')"
npm show @mangata-finance/sdk dist-tags."$(echo "${{ github.event.inputs.branch }}" | sed -E 's@[/\.]@-@g; s@_@-@g')"

0 comments on commit 56a64cd

Please sign in to comment.