You've already forked pedini.dev
Change deployment workflow to trigger on tag pushes instead of main branch pushes, allowing for more controlled and versioned deployments.
35 lines
1.1 KiB
YAML
35 lines
1.1 KiB
YAML
---
|
|
name: Deploy website on production server when committing on main
|
|
concurrency: 1
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- '*'
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- run: echo "${{ secrets.SSH_PRIVATE_KEY }}" > /private.key
|
|
- run: chmod 600 /private.key
|
|
- run: |
|
|
export HUGO_VERSION=$(curl --silent -I https://github.com/gohugoio/hugo/releases/latest | grep location | sed 's|.*tag/||' | tr -d '\r')
|
|
export HUGO_VERSION_SHORT=$(echo ${HUGO_VERSION} | sed 's/v//')
|
|
wget https://github.com/gohugoio/hugo/releases/download/${HUGO_VERSION}/hugo_${HUGO_VERSION_SHORT}_linux-amd64.deb
|
|
dpkg -i hugo_*.deb
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
- run: APP_VERSION=latest make
|
|
- run: |
|
|
export SSH_PRIVATE_KEY=/private.key
|
|
export SSH_USERNAME=${{ secrets.SSH_USERNAME }}
|
|
export DEPLOYMENT_HOST=${{ secrets.DEPLOYMENT_HOST }}
|
|
export DEPLOYMENT_PATH=${{ secrets.DEPLOYMENT_PATH }}
|
|
make deploy
|