First test of CICD
This commit is contained in:
parent
fa032f4500
commit
3c7527d4f8
1 changed files with 38 additions and 0 deletions
38
.forgejo/workflows/duuni.yaml
Normal file
38
.forgejo/workflows/duuni.yaml
Normal file
|
@ -0,0 +1,38 @@
|
|||
name: build
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: "install dependencies"
|
||||
run: apt update && apt install mkdocs mkdocs-material mkdocs-material-extensions
|
||||
- name: "build & push"
|
||||
run: mkdocs build
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: site
|
||||
path: site/
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ startsWith(secrets.SSH_PRIVATE_KEY, '-----BEGIN OPENSSH PRIVATE KEY-----') }}
|
||||
needs: [build]
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
run: apt-get update && apt-get install --no-install-recommends -y rsync openssh-client
|
||||
- name: Install SSH key
|
||||
run: |
|
||||
set -e
|
||||
echo -e 'Installing ssh keys...'
|
||||
mkdir -p ~/.ssh
|
||||
chmod 700 ~/.ssh
|
||||
echo -e "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_foobar
|
||||
echo -e "${{ vars.SSH_PUBLIC_KEY }}" > ~/.ssh/id_foobar.pub
|
||||
echo -e "${{ vars.SSH_PUBLIC_KEY }}" > ~/.ssh/known_hosts
|
||||
chmod 600 ~/.ssh/*
|
||||
- uses: actions/download-artifact@v3
|
||||
- name: Send built pages to server
|
||||
run: rsync -rclthv --exclude .git --delete-after site/ ${{ vars.SSH_USER }}@${{ vars.SSH_HOST }}:${{ vars.SSH_PATH }}
|
Loading…
Add table
Reference in a new issue