Skip to content

Commit

Permalink
feat: add publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ole1011 committed Oct 31, 2024
1 parent cc8733b commit c0d35b9
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish
on:
push:
branches: [ "develop", "main" ]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
name: Deploy website
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: '0'

- name: Upload source to Hetzner via SCP
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
port: ${{ secrets.PORT }}
source: "/home/runner/work/portfolio/portfolio/"
target: "/home/${{ secrets.USERNAME }}/docker/portfolio"
timeout: 120s
strip_components: 2

- name: Restart Website via SSH
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
port: ${{ secrets.PORT }}
script: |
cd /home/${{ secrets.USERNAME }}/docker/portfolio
docker compose down
docker build -t portfolio .
docker compose up -d

0 comments on commit c0d35b9

Please sign in to comment.