👷 Switch to Gitea Actions
All checks were successful
publish

This commit is contained in:
Marcel Kapfer 2023-04-01 21:34:25 +02:00
parent 1e51334059
commit ecf6b1dcd0
Signed by: mmk2410
GPG key ID: CADE6F0C09F21B09
2 changed files with 50 additions and 20 deletions

View 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}}

View file

@ -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