unset specific runner #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to DeNBI Faroe server | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
pull_request: | |
branches: | |
- main | |
- dev | |
jobs: | |
deploy: | |
runs-on: self-hosted | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set deployment path | |
run: | | |
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then | |
echo "DEPLOY_PATH=/var/www/production/knowledgebase.nfdi4microbiota.de" >> $GITHUB_ENV | |
elif [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then | |
echo "DEPLOY_PATH=/var/www/development/knowledgebase.nfdi4microbiota.de" >> $GITHUB_ENV | |
else | |
echo "Unknown branch. Skipping deployment." | |
exit 1 | |
fi | |
- name: Build Jekyll site with Docker | |
run: | | |
docker run --rm -v $PWD:/srv/jekyll -v $PWD/vendor/bundle:/usr/local/bundle \ | |
jekyll/jekyll:latest jekyll build -d _site | |
- name: Deploy to server | |
run: | | |
sudo rm -rf $DEPLOY_PATH/* | |
sudo cp -r _site/* $DEPLOY_PATH/ | |
sudo chown -R www-data:www-data $DEPLOY_PATH | |
- name: Cleanup build artifacts | |
run: | | |
rm -rf _site | |
rm -rf vendor | |
docker system prune -f |