Skip to content

Commit

Permalink
config: add deploy workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ludchieng committed Aug 5, 2023
1 parent 3ca9df4 commit 9a1aed1
Show file tree
Hide file tree
Showing 5 changed files with 351 additions and 19 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build & Deploy

on:
push:
branches: [ "svelte" ]

jobs:
build-and-deploy:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [19.x]

steps:
- uses: actions/checkout@v3

- name: Use Node ${{ matrix.node-version }}
uses: actions/setup-node@v3

- name: Get NPM cache directory
id: npm-cache-dir
run: echo "::set-output name=dir::$(npm cache dir)"

- uses: actions/cache@v2
id: npm-cache
with:
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}

- run: npm ci

- run: npm run build --if-present

- uses: a7ul/tar-action@master
with:
command: c
cwd: "./"
files: |
build/
package.json
captain-definition
outPath: deploy.tar

- name: Deploy App to CapRover
uses: caprover/[email protected]
with:
server: '${{ secrets.CAPROVER_SERVER }}'
app: '${{ secrets.APP_NAME_V2 }}'
token: '${{ secrets.APP_TOKEN_V2 }}'
14 changes: 14 additions & 0 deletions captain-definition
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"schemaVersion": 2,
"dockerfileLines": [
"FROM node:19-alpine",
"RUN mkdir -p /usr/src/app",
"WORKDIR /usr/src/app",
"COPY ./package.json /usr/src/app",
"COPY ./build /usr/src/app",
"ENV NODE_ENV production",
"ENV PORT 80",
"EXPOSE 80",
"CMD [ \"node\", \"index.js\" ]"
]
}
Loading

0 comments on commit 9a1aed1

Please sign in to comment.