Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Commit

Permalink
Add hetzner deploy (#1)
Browse files Browse the repository at this point in the history
* new prod

* exclude test

* test new prod

* next test

* test with key

* changed dir

* new envs

* removing comments

* ci: use fewer builds

* ci: fix missing download

* ci: specify workflow

* ci: revert changes

* ci: change deploy branches

---------

Co-authored-by: Kevin Yven Riexinger <info@kevinriexinger.de>
  • Loading branch information
kdev and Kevin Yven Riexinger committed Nov 3, 2023
1 parent e8a5f99 commit 511d3ac
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 19 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/build-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ name: Build Project for manual deployment

on:
push:
branches: ['main']
branches: ['main', 'dev']
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: 'pages'
group: 'build'
cancel-in-progress: false

jobs:
Expand All @@ -25,8 +24,6 @@ jobs:
with:
node-version: 'lts/*'
cache: npm
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Restore Cache
uses: actions/cache@v3
with:
Expand All @@ -38,6 +35,7 @@ jobs:
- name: Build with Next.js
run: npx --no-install next build
- name: Upload Artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-artifact@v3
with:
name: project-build-${{ github.sha }}
path: ./out
50 changes: 37 additions & 13 deletions .github/workflows/hetzner-prod.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,45 @@
name: Vercel Production Deployment
name: Hetzner Production Deployment
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
SERVER_HOST: ${{ secrets.SERVER_HOST }}
SERVER_PORT: ${{ secrets.SERVER_PORT }}
SERVER_USER: ${{ secrets.SERVER_USER }}
SERVER_PASS: ${{ secrets.SERVER_PASS }}
on:
push:
branches:
- main

concurrency:
group: 'hetzner-prod'
cancel-in-progress: false

jobs:
Deploy-Production:
Deploy-Production-Hetzner:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Checkout
uses: actions/checkout@v3

- name: Node Setup
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: npm clean install
run: npm ci

- name: npm build
run: npm run build

- name: copy file via ssh key
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SERVER_HOST }}
port: ${{ secrets.SERVER_PORT }}
username: ${{ secrets.SERVER_USER }}
password: ${{ secrets.SERVER_PASS }}
key: ${{ secrets.SERVER_KEY }}
source: './out'
target: 'public/'
strip_components: 2 # this is important
1 change: 1 addition & 0 deletions .github/workflows/vercel-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
push:
branches-ignore:
- main
- test
jobs:
Deploy-Preview:
runs-on: ubuntu-latest
Expand Down
Binary file removed out.zip
Binary file not shown.

0 comments on commit 511d3ac

Please sign in to comment.