Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/0xSpaceShard/nimbora-docs
Browse files Browse the repository at this point in the history
…into develop
  • Loading branch information
ioanSL committed Mar 18, 2024
2 parents 076cf42 + a0897cd commit af4d3e2
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/deploy-docusaurus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
node-version: '18'

- name: Install and Build
env:
EXCLUDE_FILES: ${{ vars.EXCLUDE_FILES_MAIN }}
run: |
npm install
npm run build
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: build-deploy

on:
push:
branches:
- stage

env:
working-directory: .

jobs:
deploy:
runs-on: ubuntu-latest
if: github.ref_name == ${{ github.ref_name }}
steps:
- name: Deploy the service to "${{ github.ref_name }}"
uses: appleboy/[email protected]
with:
host: ${{ secrets[format('SSH_HOST_{0}', github.ref_name)] }}
username: ${{ secrets[format('SSH_USER_{0}', github.ref_name)] }}
key: ${{ secrets[format('SSH_PRIVATE_KEY_{0}', github.ref_name)] }}
port: ${{ secrets[format('SSH_PORT_{0}', github.ref_name)] }}
script: |
SSH_NESTED_HOST="${{ secrets[format('SSH_NESTED_HOST_{0}', github.ref_name)] }}"
ssh $SSH_NESTED_HOST -T <<EOA
echo "### Deployment started"
if [ -d "${{ secrets.BASE_PATH }}/${{ github.repository }}-${{ github.ref_name }}" ]; then
cd ${{ secrets.BASE_PATH }}/${{ github.repository }}-${{ github.ref_name }} && \
echo "### Generate ENV file"
> .env
echo BRANCH=${{ github.ref_name }} >> .env
echo PORT=${{ vars[format('PORT_{0}', github.ref_name)] }} >> .env
echo EXCLUDE_FILES=${{ vars[format('EXCLUDE_FILES_{0}', github.ref_name)] }} >> .env
git fetch && \
git checkout ${{ github.ref_name }} && \
git reset --hard origin/${{ github.ref_name }} && \
docker-compose -f docker-compose.yml pull && \
docker-compose -f docker-compose.yml up -d --build
else
echo "Directory does not exist, aborting script."
exit 1
fi
EOA
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM node:alpine3.18 as build

WORKDIR /app
COPY package.json yarn.lock ./

RUN yarn

COPY . .
17 changes: 17 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: '3.9'
services:
nimbora-docs:
container_name: nimbora-docs_${BRANCH}
build:
context: .
ports:
- ${PORT}:${PORT}
environment:
- EXCLUDE_FILES=${EXCLUDE_FILES}
command: ['yarn', 'start', '-h', '0.0.0.0', '-p', '${PORT}']
logging:
driver: 'json-file'
options:
tag: '{{.ImageName}}|{{.Name}}|{{.ImageFullID}}|{{.FullID}}'
max-size: '50m'
max-file: '100'

0 comments on commit af4d3e2

Please sign in to comment.