Skip to content

Commit

Permalink
fix(ci): Try to build on GH worker and deploy statics with rsync
Browse files Browse the repository at this point in the history
  • Loading branch information
munshkr committed Mar 17, 2024
1 parent fb7dc86 commit fcefa2e
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
22 changes: 21 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 20
- run: npm install
- run: npm run build

- name: Configure SSH
run: |
mkdir -p ~/.ssh/
Expand All @@ -26,11 +33,24 @@ jobs:
SSH_KEY: ${{ secrets.SSH_KEY }}
SSH_HOST: ${{ secrets.SSH_HOST }}

- name: Build
- name: Build all except web
run: ssh prod 'cd flok && git fetch && git reset --hard ${{ github.sha }} && npm install'

- name: Sync web build
uses: burnett01/rsync-deployments@7.0.0
with:
switches: -avzr --delete
path: packages/web/dist/
remote_path: flok/packages/web/dist/
remote_host: ${{ secrets.SSH_HOST }}
remote_user: ${{ secrets.SSH_USER }}
remote_key: ${{ secrets.SSH_KEY }}

- name: Restart server
run: ssh prod 'sudo systemctl restart flok'

- name: Check status
run: ssh prod 'sudo systemctl status flok'

- name: Healthcheck
run: curl -I https://flok.cc/ | grep "200 OK" || exit 1
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run build
# - run: npm test
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ Install all dependencies and build all subpackages with:

```sh
npm install
npm run build
```

Then, to run web server:
Expand All @@ -242,10 +243,9 @@ cd packages/web
npm run dev
```

To build and run production build:
To run production build:

```sh
npm run build
npm start
```

Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
"url": "git+https://github.com/munshkr/flok.git"
},
"scripts": {
"build": "lerna run build",
"prepare": "npm run build"
"build": "lerna run build"
},
"keywords": [
"codemirror",
Expand Down

0 comments on commit fcefa2e

Please sign in to comment.