-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
109 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,85 @@ | ||
name: publish_staging_package | ||
|
||
# Controls when the action will run. | ||
on: | ||
# Triggers the workflow on push or pull request events but only for the main branch | ||
push: | ||
branches: [staging] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains 2 jobs called "run-unit-test" "build" | ||
run-unit-test: | ||
uses: ./.github/workflows/reuseable-test.yaml | ||
|
||
build: | ||
needs: | ||
- run-unit-test | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
node-version: [">=16.0.0"] | ||
|
||
steps: | ||
- name: Cancel Previous Runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Overwrite package.json | ||
run: cp -av packages/oraidex-server/package.staging.json packages/oraidex-server/package.json | ||
- name: Rename package folder | ||
run: mv packages/oraidex-server packages/oraidex-server-staging | ||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
- uses: actions/cache@v2 | ||
id: yarn-cache | ||
with: | ||
path: | | ||
${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
./node_modules/ | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
- name: Install Dependencies | ||
if: steps.yarn-cache.outputs.cache-hit != 'true' | ||
run: yarn | ||
- name: Build | ||
run: yarn build packages/contracts-sdk && yarn build packages/oraidex-sync && yarn --cwd packages/oraidex-server-staging/ build | ||
- name: Authenticate with private NPM package | ||
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN_STAGING }}" > ~/.npmrc | ||
- name: Publish | ||
id: publish | ||
continue-on-error: true | ||
run: yarn deploy packages/oraidex-server-staging | ||
env: | ||
CI: false | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN_STAGING }} | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_STAGING }} | ||
|
||
- name: Install latest version | ||
id: install | ||
if: steps.publish.outcome != 'failure' | ||
continue-on-error: true | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.DOCKER_SWARM_MANAGER_ONE }} | ||
username: root | ||
key: ${{ secrets.DOCKER_SWARM_MANAGER_ONE_KEY }} | ||
script: docker exec ${{ secrets.DOCKER_SWARM_MANAGER_ONE_NODE_16_ID}} sh -c 'yarn global add @oraichain/oraidex-server-staging@latest --ignore-scripts' | ||
|
||
- name: send result via discord | ||
uses: appleboy/discord-action@master | ||
with: | ||
webhook_id: ${{ secrets.WEBHOOK_ID }} | ||
webhook_token: ${{ secrets.WEBHOOK_TOKEN }} | ||
username: "GitBot [oraidex-server-staging]" | ||
message: "Repo oraidex-sdk has just published oraidex-server-staging. result: ${{ steps.publish.outcome }}. install result: ${{ steps.install.outcome }}. ${{ github.event.head_commit.author.name }}" |
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,24 @@ | ||
{ | ||
"name": "@oraichain/oraidex-server-staging", | ||
"version": "1.0.0", | ||
"main": "dist/index.js", | ||
"bin": "dist/index.js", | ||
"license": "MIT", | ||
"files": ["dist/"], | ||
"scripts": { | ||
"build": "ncc build src/index.ts --no-source-map-register -t -m" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@types/cors": "^2.8.13", | ||
"@types/express": "^4.17.17", | ||
"@cosmjs/cosmwasm-stargate": "^0.31.0", | ||
"@cosmjs/stargate": "^0.31.0", | ||
"@oraichain/common-contracts-sdk": "1.0.13", | ||
"@cosmjs/tendermint-rpc": "^0.31.0", | ||
"@oraichain/oraidex-sync": "1.0.0", | ||
"cors": "^2.8.5", | ||
"express": "^4.18.2", | ||
"@vercel/ncc": "=0.34.0" | ||
} | ||
} |