You've already forked pedini.dev
49 lines
1.5 KiB
YAML
49 lines
1.5 KiB
YAML
---
|
|
name: Deploy website on production server on a tag
|
|
concurrency:
|
|
group: deploy
|
|
cancel-in-progress: false
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- '*'
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Install latest Hugo
|
|
run: |
|
|
set -euo pipefail
|
|
tag="$(curl --silent --show-error --location --fail-with-body \
|
|
-H 'Accept: application/vnd.github+json' \
|
|
https://api.github.com/repos/gohugoio/hugo/releases/latest \
|
|
| jq -r '.tag_name // empty')"
|
|
[ -n "$tag" ] || { echo "no tag_name in gohugoio/hugo releases/latest" >&2; exit 1; }
|
|
export HUGO_VERSION="$tag"
|
|
export HUGO_VERSION_SHORT="${HUGO_VERSION#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: |
|
|
mkdir -p ~/.ssh/
|
|
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519
|
|
chmod 600 ~/.ssh/id_ed25519
|
|
echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
|
|
make
|
|
make deploy
|
|
env:
|
|
SSH_USERNAME: ${{ vars.SSH_USERNAME }}
|
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
SSH_KNOWN_HOSTS: ${{ vars.SSH_KNOWN_HOSTS }}
|
|
DEPLOYMENT_HOST: ${{ vars.DEPLOYMENT_HOST }}
|
|
DEPLOYMENT_PATH: ${{ vars.DEPLOYMENT_PATH }}
|
|
APP_VERSION: ${{ env.GITEA_REF_NAME }}
|