-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #90 from Synthetixio/ci-update
new features for CI
- Loading branch information
Showing
2 changed files
with
34 additions
and
17 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
name: Main Workflow | ||
on: | ||
push: {} | ||
pull_request: | ||
branches: | ||
- main | ||
- master | ||
|
||
jobs: | ||
build: | ||
|
@@ -17,9 +20,13 @@ jobs: | |
- run: npm run lint | ||
- run: npx lerna run build | ||
- run: npx lerna run test | ||
- run: git config --global user.email "[email protected]" && git config --global user.name "Your Name" | ||
- run: npx lerna version 0.0.0-$(git rev-parse --short HEAD) --exact --no-push -y | ||
- run: npx lerna publish from-package --npm-tag dev --skip-git -y | ||
|
||
# publish | ||
- run: git config --global user.email "[email protected]" && git config --global user.name "Synthetix CI" | ||
- run: git fetch origin ${{ github.head_ref }} | ||
- run: echo $(git rev-parse --short origin/${{ github.head_ref }}) | ||
#- run: npx lerna version 0.0.0-$(git rev-parse --short origin/${{ github.head_ref }}) --exact --no-push -y | ||
- run: npx lerna exec npm version 0.0.0-$(git rev-parse --short origin/${{ github.head_ref }}) | ||
- run: npx lerna exec npm publish -- --tag dev | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
- run: echo "npm pushed to 0.0.0-$(git rev-parse --short HEAD)" |
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,9 +1,14 @@ | ||
name: Publish Library | ||
|
||
on: | ||
repository_dispatch: | ||
types: update-synthetix | ||
workflow_dispatch: {} | ||
workflow_dispatch: | ||
inputs: | ||
synthetix_version: | ||
description: 'Upstream `synthetix` repo version (leave empty if no update)' | ||
required: false | ||
monorepo_version: | ||
description: 'New Monorepo Version (ex. 2.50.0-alpha) (leave empty to "bump")' | ||
required: false | ||
|
||
jobs: | ||
update_version: | ||
|
@@ -15,14 +20,19 @@ jobs: | |
with: | ||
node-version: '14' | ||
registry-url: 'https://registry.npmjs.org' | ||
- name: Update @synthetixio/contracts-interface | ||
- name: resolve version | ||
run: | | ||
echo "Update @synthetixio/contracts-interface with synthetix@${{ github.event.client_payload.version }}" | ||
cd packages/contracts-interface && npm install synthetix@${{ github.event.client_payload.version }} --save-exact | ||
- name: Commit changes | ||
export theversion="bump" | ||
if [ -n "${{ github.event.inputs.monorepo_version }}" ]; then export theversion="${{ github.event.inputs.monorepo_version }}"; fi | ||
echo "Resolved version $theversion" | ||
echo "new_version=$theversion" >> $GITHUB_ENV | ||
- name: Update @synthetixio/contracts-interface | ||
if: github.event.inputs.synthetix_version | ||
run: | | ||
git config --global user.email "[email protected]" && git config --global user.name "Synthetix Team" | ||
git commit -am 'synthetix@${{ github.event.client_payload.version }}' | ||
echo "Update @synthetixio/contracts-interface with synthetix@${{ github.event.inputs.synthetix_version }}" | ||
cd packages/contracts-interface && npm install synthetix@${{ github.event.inputs.synthetix_version }} --save-exact | ||
git config --global user.email "[email protected]" && git config --global user.name "Synthetix CI" | ||
git commit -am "synthetix@${{ github.event.inputs.synthetix_version }}" | ||
- name: Lints and build | ||
run: | | ||
npm ci | ||
|
@@ -31,7 +41,7 @@ jobs: | |
npm run build | ||
npm run test-all | ||
- name: Update packages version | ||
run: lerna version ${{ github.event.client_payload.version }} --exact --yes | ||
run: lerna version ${{ env.new_version }} --exact --yes | ||
- name: Publish packages | ||
run: lerna publish from-package --yes | ||
env: | ||
|
@@ -40,5 +50,5 @@ jobs: | |
run: git push | ||
- name: Notify dApps | ||
run: | | ||
curl -H "Authorization: token ${{ secrets.GH_TOKEN_DAPPS }}" --request POST --data "{\"event_type\": \"update-dependency\", \"client_payload\": {\"version\": \"${{ github.event.client_payload.version }}\"}}" https://api.github.com/repos/Synthetixio/staking/dispatches | ||
curl -H "Authorization: token ${{ secrets.GH_TOKEN_DAPPS }}" --request POST --data "{\"event_type\": \"update-dependency\", \"client_payload\": {\"version\": \"${{ github.event.client_payload.version }}\"}}" https://api.github.com/repos/Kwenta/kwenta/dispatches | ||
curl -H "Authorization: token ${{ secrets.GH_TOKEN_DAPPS }}" --request POST --data "{\"event_type\": \"update-dependency\", \"client_payload\": {\"version\": \"${{ env.new_version }}\"}}" https://api.github.com/repos/Synthetixio/staking/dispatches | ||
curl -H "Authorization: token ${{ secrets.GH_TOKEN_DAPPS }}" --request POST --data "{\"event_type\": \"update-dependency\", \"client_payload\": {\"version\": \"${{ env.new_version }}\"}}" https://api.github.com/repos/Kwenta/kwenta/dispatches |