-
Notifications
You must be signed in to change notification settings - Fork 1
41 lines (35 loc) · 1.33 KB
/
deploy.yml
File metadata and controls
41 lines (35 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: Build & Deploy
on:
push:
branches: ['main']
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1
- uses: bahmutov/npm-install@v1.8.36
- uses: actions/cache@v3.3.2
with:
path: |
~/.npm
${{ github.workspace }}/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
- name: Set environment variables for version tracking
run: |
echo "NEXT_PUBLIC_VERSION_LABEL=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV
echo "NEXT_PUBLIC_VERSION_URL=https://github.com/mhoff/meshup/commit/${{ github.sha }}" >> $GITHUB_ENV
- name: Build
run: npm run build
- name: Deploy
uses: up9cloud/action-rsync@v1.4
env:
ARGS: -ar --delete
SOURCE: out/
HOST: ${{ secrets.DEPLOY_HOST }}
USER: ${{ secrets.DEPLOY_USER }}
KEY: ${{ secrets.DEPLOY_SSH_KEY }}
TARGET: ${{ secrets.DEPLOY_TARGET }}