Update versions #2
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: Update Downstream Repositories | |
on: | |
push: | |
branches: | |
- main | |
- feat/downstream_repo_pr | |
paths: | |
- '**/package.json' | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
GH_USER: ${{ secrets.GH_USER }} | |
GH_EMAIL: ${{ secrets.GH_EMAIL }} | |
jobs: | |
update-downstream-repos: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Extract version from package.json | |
id: package_version | |
run: echo "::set-output name=version::$(jq -r '.version' package.json)" | |
- name: "Update axiom-quickstart package version" | |
env: | |
NEW_VERSION: ${{ steps.package_version.outputs.version }} | |
run: | | |
git config --global user.name $GH_USER | |
git config --global user.email $GH_EMAIL | |
git clone https://$GH_USER:[email protected]/axiom-crypto/axiom-quickstart.git | |
cd axiom-quickstart | |
sed -i "s/\"@axiom-crypto\/client\": \".*\"/\"@axiom-crypto\/client\": \"$NEW_VERSION\"/" package.json | |
git checkout -b feat/v$NEW_VERSION | |
git add package.json | |
git commit -m "Update axiom-sdk-client version to $NEW_VERSION" | |
git push origin feat/v$NEW_VERSION | |
gh pr create \ | |
--title "Update axiom-sdk-client version to $NEW_VERSION" \ | |
--body "This is an automated pull request to update the axiom-sdk-client version to $NEW_VERSION" \ | |
--repo axiom-crypto/axiom-quickstart \ | |
--head feat/v$NEW_VERSION \ | |
--base main | |
- name: "Update axiom-scaffold-nextjs package version" | |
env: | |
NEW_VERSION: ${{ steps.package_version.outputs.version }} | |
run: | | |
git config --global user.name $GH_USER | |
git config --global user.email $GH_EMAIL | |
git clone https://$GH_USER:[email protected]/axiom-crypto/axiom-scaffold-nextjs.git | |
cd axiom-scaffold-nextjs | |
sed -i "s/\"@axiom-crypto\/client\": \".*\"/\"@axiom-crypto\/client\": \"$NEW_VERSION\"/" package.json | |
sed -i "s/\"@axiom-crypto\/react\": \".*\"/\"@axiom-crypto\/react\": \"$NEW_VERSION\"/" package.json | |
git checkout -b feat/v$NEW_VERSION | |
git add package.json | |
git commit -m "Update axiom-sdk-client version to $NEW_VERSION" | |
git push origin feat/v$NEW_VERSION | |
gh pr create \ | |
--title "Update axiom-sdk-client version to $NEW_VERSION" \ | |
--body "This is an automated pull request to update the axiom-sdk-client version to $NEW_VERSION" \ | |
--repo axiom-crypto/axiom-scaffold-nextjs \ | |
--head feat/v$NEW_VERSION \ | |
--base main |