You've already forked pedini.dev
Configure concurrency group for website deployment workflow to prevent race conditions and ensure orderly deployment execution. The cancel-in-progress setting is set to false to maintain deployment stability.
37 lines
1.1 KiB
YAML
37 lines
1.1 KiB
YAML
---
|
|
name: Deploy website on production server when committing on main
|
|
concurrency:
|
|
group: deploy-website
|
|
cancel-in-progress: false
|
|
|
|
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
|