mirror of
https://github.com/maikka39/Personal-Website.git
synced 2026-10-02 14:46:25 +00:00
Implement new deployment mechanism for new server
This commit is contained in:
@@ -10,25 +10,53 @@ defaults:
|
|||||||
working-directory: ./
|
working-directory: ./
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
cd:
|
build:
|
||||||
timeout-minutes: 6
|
timeout-minutes: 6
|
||||||
name: CD
|
name: Build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup hugo
|
- name: Setup hugo
|
||||||
uses: peaceiris/actions-hugo@v2
|
uses: peaceiris/actions-hugo@v3
|
||||||
with:
|
with:
|
||||||
hugo-version: "latest"
|
hugo-version: "latest"
|
||||||
extended: true
|
extended: true
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: hugo -D -F
|
run: hugo --minify
|
||||||
- name: Create GitHub deployment
|
|
||||||
uses: chrnorm/deployment-action@releases/v1
|
- name: Upload deployment
|
||||||
id: deployment
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
token: "${{ github.token }}"
|
name: public-html
|
||||||
target_url: https://maik.dev/
|
path: ./public
|
||||||
environment: production
|
|
||||||
initial_status: "success"
|
deploy:
|
||||||
|
timeout-minutes: 6
|
||||||
|
name: Deploy
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build
|
||||||
|
environment:
|
||||||
|
name: production
|
||||||
|
url: https://maik.dev/
|
||||||
|
steps:
|
||||||
|
- name: Download deployment
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: public-html
|
||||||
|
path: ./public-html
|
||||||
|
|
||||||
|
- name: Setup SSH config for remote server
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
|
||||||
|
echo "${{ secrets.SSH_HOST }} ssh-ed25519 ${{ secrets.SSH_HOST_KEY }}" > ~/.ssh/known_hosts
|
||||||
|
chmod 600 ~/.ssh/id_ed25519
|
||||||
|
eval "$(ssh-agent -s)"
|
||||||
|
ssh-add ~/.ssh/id_ed25519
|
||||||
|
|
||||||
|
- name: Transfer deployment to remote server
|
||||||
|
run: |
|
||||||
|
rsync -avh --delete-after ./public-html/ ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:~/maik.dev
|
||||||
|
|||||||
@@ -22,11 +22,13 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup hugo
|
- name: Setup hugo
|
||||||
uses: peaceiris/actions-hugo@v2
|
uses: peaceiris/actions-hugo@v3
|
||||||
with:
|
with:
|
||||||
hugo-version: "latest"
|
hugo-version: "latest"
|
||||||
extended: true
|
extended: true
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: hugo -D -F
|
run: hugo -D -F
|
||||||
|
|||||||
Reference in New Issue
Block a user