-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add workflow to update dependencies on version change #82
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5416ab2
Add workflow to update dependencies on version change
a870692
Test: Bump version to 2.0.8
18099b4
Update Node.js version to 20 and actions to latest versions
9b715f2
Fix: Correct command to set packages to local versions
5726c86
Restore package.json content
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
name: Update Dependent Repositories | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'package.json' | ||
|
||
jobs: | ||
update-dependents: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20' | ||
|
||
- name: Extract version from package.json | ||
id: package_version | ||
run: echo "::set-output name=VERSION::$(cat package.json | jq -r .version)" | ||
|
||
- name: Check if version has changed | ||
id: check_version | ||
run: | | ||
VERSION=$(cat package.json | jq -r .version) | ||
LAST_VERSION=$(git tag --sort=-v:refname | head -n 1) | ||
if [ "$VERSION" != "$LAST_VERSION" ]; then | ||
echo "Version has changed from $LAST_VERSION to $VERSION" | ||
echo "::set-output name=VERSION_CHANGED::true" | ||
else | ||
echo "Version has not changed" | ||
echo "::set-output name=VERSION_CHANGED::false" | ||
exit 78 # Neutral exit to stop the workflow | ||
fi | ||
|
||
- name: Check out axiom-quickstart repository | ||
if: steps.check_version.outputs.VERSION_CHANGED == 'true' | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: 'axiom-crypto/axiom-quickstart' | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
path: 'axiom-quickstart' | ||
|
||
- name: Update @axiom-crypto/client in axiom-quickstart | ||
if: steps.check_version.outputs.VERSION_CHANGED == 'true' | ||
run: | | ||
cd axiom-quickstart | ||
jq '.dependencies["@axiom-crypto/client"] = "${{ steps.package_version.outputs.VERSION }}"' package.json > temp.json | ||
mv temp.json package.json | ||
git config user.name 'github-actions' | ||
git config user.email '[email protected]' | ||
git add package.json | ||
git commit -m 'Update @axiom-crypto/client to ${{ steps.package_version.outputs.VERSION }}' | ||
git push | ||
|
||
- name: Check out axiom-scaffold-nextjs repository | ||
if: steps.check_version.outputs.VERSION_CHANGED == 'true' | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: 'axiom-crypto/axiom-scaffold-nextjs' | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
path: 'axiom-scaffold-nextjs' | ||
|
||
- name: Update @axiom-crypto/react in axiom-scaffold-nextjs | ||
if: steps.check_version.outputs.VERSION_CHANGED == 'true' | ||
run: | | ||
cd axiom-scaffold-nextjs | ||
jq '.dependencies["@axiom-crypto/react"] = "${{ steps.package_version.outputs.VERSION }}"' package.json > temp.json | ||
mv temp.json package.json | ||
git config user.name 'github-actions' | ||
git config user.email '[email protected]' | ||
git add package.json | ||
git commit -m 'Update @axiom-crypto/react to ${{ steps.package_version.outputs.VERSION }}' | ||
git push | ||
|
||
- name: Create Pull Request for axiom-quickstart | ||
if: steps.check_version.outputs.VERSION_CHANGED == 'true' | ||
uses: repo-sync/pull-request@v3 | ||
with: | ||
source_branch: "main" | ||
destination_branch: "update-dependency-${{ steps.package_version.outputs.VERSION }}" | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
pr_title: "Update @axiom-crypto/client to ${{ steps.package_version.outputs.VERSION }}" | ||
pr_body: "This PR updates the @axiom-crypto/client package to version ${{ steps.package_version.outputs.VERSION }}." | ||
|
||
- name: Create Pull Request for axiom-scaffold-nextjs | ||
if: steps.check_version.outputs.VERSION_CHANGED == 'true' | ||
uses: repo-sync/pull-request@v3 | ||
with: | ||
source_branch: "main" | ||
destination_branch: "update-dependency-${{ steps.package_version.outputs.VERSION }}" | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
pr_title: "Update @axiom-crypto/react to ${{ steps.package_version.outputs.VERSION }}" | ||
pr_body: "This PR updates the @axiom-crypto/react package to version ${{ steps.package_version.outputs.VERSION }}." |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,45 @@ | ||
{ | ||
"name": "axiom-sdk-client", | ||
"version": "2.0.7", | ||
"description": "Axiom client SDK", | ||
"version": "2.0.8", | ||
"description": "Axiom client SDK for interacting with Axiom blockchain services", | ||
"scripts": { | ||
"remote": "node -e 'require(\"./scripts/setRemote.js\").setRemote()'", | ||
"local": "node scripts/setLocal.js", | ||
"versions": "node scripts/setVersions.js", | ||
"build-all": "node scripts/buildAll.js", | ||
"publish-all": "node scripts/publishAll.js" | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"build": "tsc", | ||
"lint": "eslint . --ext .ts", | ||
"prepare": "npm run build", | ||
"prepublishOnly": "npm test && npm run lint", | ||
"setLocal": "node scripts/setLocal.js", | ||
"setRemote": "node scripts/setRemote.js", | ||
"setVersions": "node scripts/setVersions.js", | ||
"buildAll": "node scripts/buildAll.js", | ||
"publishAll": "node scripts/publishAll.js" | ||
}, | ||
"keywords": [], | ||
"author": "Intrinsic Technologies", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/axiom-crypto/axiom-sdk-client.git" | ||
}, | ||
"keywords": [ | ||
"axiom", | ||
"sdk", | ||
"client", | ||
"blockchain", | ||
"crypto" | ||
], | ||
"author": "Axiom Crypto", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/axiom-crypto/axiom-sdk-client/issues" | ||
}, | ||
"homepage": "https://github.com/axiom-crypto/axiom-sdk-client#readme", | ||
"devDependencies": { | ||
"ethers": "^6.11.1" | ||
"@types/node": "^12.0.0", | ||
"typescript": "^3.8.3", | ||
"eslint": "^6.8.0", | ||
"prettier": "^2.0.5" | ||
}, | ||
"dependencies": { | ||
"@axiom-crypto/base": "^1.0.0", | ||
"axios": "^0.19.2", | ||
"ethers": "^5.0.0" | ||
} | ||
} | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't want to delete the entire contents of package.json