Skip to content

Commit

Permalink
Merge pull request #90 from Synthetixio/ci-update
Browse files Browse the repository at this point in the history
new features for CI
  • Loading branch information
0xclem authored Sep 30, 2021
2 parents 7f37a2c + 28b3f58 commit 9da6371
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 17 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/main.yml
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:
Expand All @@ -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)"
34 changes: 22 additions & 12 deletions .github/workflows/updateDependency.yml
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:
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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

0 comments on commit 9da6371

Please sign in to comment.