Skip to content

Update template Konferenzseminar #6

Update template Konferenzseminar

Update template Konferenzseminar #6

# ==============================================================================
#
# FILE: publish-templates.yml
#
# USAGE: called on push
#
# DESCRIPTION: This action generates a website from the latex templates. The
# website is created in a temporary directory and then pushed to
# the remote repository.
#
# OPTIONS: see section 'env'
# REQUIREMENTS: A key pair is needed to be able to push to the remote
# repository. The private key needs to be added as a secret named
# 'ID_RSA' to this repository. The public key needs to be added
# as a deploy key to the remote repository.
# BUGS: ---
# NOTES: ---
# AUTHOR: Fabian Eberts
# ORGANIZATION: ---
# CREATED: ---
# REVISION: ---
#
# ==============================================================================
name: Publish LaTeX Templates
on: [push]
jobs:
Publish-Templates:
runs-on: ubuntu-latest
env:
REMOTE_REPO: "fhswf/LaTeX-Editor"
REMOTE_CUSTOM_URL: "" # optional, leave empty ("") if not needed
steps:
- name: Check out this repo (templates)
uses: actions/checkout@v3
with:
path: this_repo
- name: Check out remote repo (website)
uses: actions/checkout@v3
with:
repository: ${{ env.REMOTE_REPO }}
path: remote_repo
- name: Generate website from templates
run: |
mkdir ${{ github.workspace }}/new_website/
cd ${{ github.workspace }}/this_repo
./generate-website.sh "${{ github.workspace }}/new_website/" "$REMOTE_REPO" "$REMOTE_CUSTOM_URL"
- name: Add website to remote repo
run: |
cd ${{ github.workspace }}/remote_repo
git rm -r .
cp -r ${{ github.workspace }}/new_website/* .
git add .
- name: Set up SSH
run: |
mkdir ~/.ssh
echo "${{ secrets.ID_RSA }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_rsa
- name: Commit and push to remote repo
run: |
cd ${{ github.workspace }}/remote_repo
git remote set-url origin "git@github.com:${REMOTE_REPO}.git"
git config user.name "github action"
git config user.email "noreply"
git commit --allow-empty -am "update"
git push