Skip to content

Major improvement

Major improvement #26

Workflow file for this run

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 }}