coyotte508's picture
coyotte508 HF staff
πŸš€ Better deploy code
6ba478e
raw
history blame
1.04 kB
name: deploy
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 7.33.1
- uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'pnpm'
- run: |
pnpm install --frozen-lockfile
echo $DOT_ENV > .env.local
pnpm build
env:
DOT_ENV: ${{ vars.DOT_ENV }}
- name: Install SSH Key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
- name: Deploy
run: |
zip -r build.zip build
scp build.zip ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:bergere-enchantee/build.zip
ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "hostnamectl && cd bergere-enchantee && git fetch && git checkout $GITHUB_SHA && pnpm install && unzip -o build.zip && pm2 reload bergere"