parent
1e51334059
commit
ecf6b1dcd0
2 changed files with 50 additions and 20 deletions
50
.gitea/workflows/publish.yaml
Normal file
50
.gitea/workflows/publish.yaml
Normal file
|
@ -0,0 +1,50 @@
|
|||
name: Publish
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
container: silex/emacs:27.2-alpine-ci
|
||||
steps:
|
||||
- name: Install packages
|
||||
run: apk add --no-cache openssh nodejs
|
||||
|
||||
- name: Add SSH key
|
||||
run: |
|
||||
mkdir ~/.ssh
|
||||
chmod 700 ~/.ssh
|
||||
echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_ed25519
|
||||
chmod 600 ~/.ssh/id_ed25519
|
||||
echo "$SSH_KNOWN_HOSTS" | tr -d '\r' >> ~/.ssh/known_hosts
|
||||
chmod 644 ~/.ssh/known_hosts
|
||||
env:
|
||||
SSH_PRIVATE_KEY: ${{secrets.SSH_PRIVATE_KEY}}
|
||||
SSH_KNOWN_HOSTS: ${{secrets.SSH_KNOWN_HOSTS}}
|
||||
|
||||
- name: Check out
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Build publish script
|
||||
run: emacs -Q --script publish/publish.el
|
||||
|
||||
- name: Install rsync
|
||||
run: apk add --no-cache rsync
|
||||
|
||||
- name: Deploy build
|
||||
run: |
|
||||
rsync \
|
||||
--archive \
|
||||
--verbose \
|
||||
--chown=gitlab-ci:www-data\
|
||||
--delete\
|
||||
--progress\
|
||||
-e"ssh -p "$SSH_PORT""\
|
||||
public/\
|
||||
"$SSH_USER"@mmk2410.org:/var/www/config.mmk2410.org/
|
||||
env:
|
||||
SSH_USER: ${{secrets.SSH_USER}}
|
||||
SSH_PORT: ${{secrets.SSH_PORT}}
|
|
@ -1,20 +0,0 @@
|
|||
before_script:
|
||||
- apk add --no-cache openssh tzdata
|
||||
- cp /usr/share/zoneinfo/Europe/Berlin /etc/localtime
|
||||
- eval $(ssh-agent -s)
|
||||
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
|
||||
- mkdir ~/.ssh
|
||||
- chmod 700 ~/.ssh
|
||||
- echo "$SSH_KNOWN_HOSTS" | tr -d '\r' >> ~/.ssh/known_hosts
|
||||
- chmod 644 ~/.ssh/known_hosts
|
||||
|
||||
build:
|
||||
image: silex/emacs:27.2-alpine-ci
|
||||
stage: build
|
||||
script:
|
||||
- emacs -Q --script publish/publish.el
|
||||
- apk add --no-cache rsync
|
||||
- rsync --archive --verbose --chown=gitlab-ci:www-data --delete --progress -e"ssh -p "$SSH_PORT"" public/ "$SSH_USER"@mmk2410.org:/var/www/config.mmk2410.org/
|
||||
artifacts:
|
||||
paths:
|
||||
- public
|
Loading…
Reference in a new issue