Merge pull request #7 from Nox-HD/dependabot/npm_and_yarn/nanoid-3.3.8 #135
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Next.js to Hostinger | |
on: | |
push: | |
branches: | |
- main # Adjust this to match your branch name | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18' # Specify the Node.js version | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.npm | |
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.OS }}-node- | |
- name: Cache Next.js build | |
uses: actions/cache@v4 | |
with: | |
path: ${{ github.workspace }}/.next/cache | |
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }} | |
restore-keys: | | |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- | |
- name: Install dependencies | |
run: npm ci | |
- name: Build the Next.js app | |
run: npm run build # This includes static export with output: 'export' | |
- name: Deploy to Hostinger via FTP | |
uses: SamKirkland/FTP-Deploy-Action@4.3.0 | |
with: | |
server: ${{ secrets.FTP_HOST }} | |
username: ${{ secrets.FTP_USERNAME }} | |
password: ${{ secrets.FTP_PASSWORD }} | |
port: ${{ secrets.FTP_PORT }} # Optional, use if a non-default port | |
local-dir: ./out/ # Ensure this ends with a slash | |
server-dir: / # Ensure this ends with a slash | |
exclude: | | |
**/.git* | |
**/.DS_Store | |
node_modules/** | |
.github/** | |
deploy.yml |