-
Notifications
You must be signed in to change notification settings - Fork 11
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
1 parent
ee1a4f3
commit 95a7f3b
Showing
5 changed files
with
91 additions
and
4 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,67 @@ | ||
name: Deploy | ||
on: | ||
push: | ||
branches: | ||
- 'deploy_action' | ||
- 'develop' | ||
paths: | ||
- 'packages/samples/**' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
|
||
- name: restore lerna | ||
uses: actions/cache@v3 | ||
with: | ||
path: '**/node_modules' | ||
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} | ||
|
||
- name: Install project dependencies and build | ||
run: npx lerna bootstrap | ||
|
||
- name: Build packages | ||
run: npm run build | ||
|
||
- name: Get GitHub organization or user | ||
run: echo 'ORG='$(echo $(dirname ${GITHUB_REPOSITORY}) | awk '{print tolower($0)}') >> $GITHUB_ENV | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USER }} | ||
password: ${{ secrets.DOCKER_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: docker/mvp-dapp/Dockerfile | ||
pull: true | ||
push: true | ||
tags: ${{ env.ORG }}/kuai-mvp-dapp:latest | ||
platforms: linux/amd64,linux/arm64 | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
redeploy: | ||
name: Redeploy webhook call | ||
runs-on: ubuntu-18.04 | ||
needs: [build] | ||
steps: | ||
- name: Deploy docker container webhook | ||
uses: joelwmale/webhook-action@master | ||
env: | ||
WEBHOOK_URL: ${{ secrets.DEPLOY_WEBHOOK_URL }} |
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,13 @@ | ||
[ | ||
{ | ||
"id": "redeploy-mvp-dapp", | ||
"execute-command": "/bin/bash", | ||
"pass-arguments-to-command": [ | ||
{ | ||
"source": "string", | ||
"name": "./redeploy.sh" | ||
} | ||
], | ||
"response-message": "Redeploying mvp dapp server." | ||
} | ||
] |
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,10 @@ | ||
#!bin/bash | ||
|
||
ORG="${DOCKER_ORG:-painterpuppets}" | ||
IMAGE="${MVP_DAPP_IMAGE:-kuai-mvp-dapp}" | ||
PORT="${MVP_DAPP_PORT:-80}" | ||
|
||
docker pull $ORG/$IMAGE:latest | ||
docker stop $(docker ps -q --filter ancestor=$ORG/$IMAGE) | ||
docker system prune -f | ||
docker run --network host -e PORT=$PORT -e HOST=0.0.0.0 -d --restart=always $ORG/$IMAGE |
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