work.suroh.tk/.gitea/workflows/deploy.yml

34 lines
895 B
YAML
Raw Normal View History

2024-02-02 17:00:10 +00:00
name: 11ty build and deploy for ${{ gitea.repository }}
run-name: 11ty build and deploy for ${{ gitea.repository }}
2024-02-02 14:16:07 +00:00
on:
push:
branches:
- 'main'
jobs:
build-deploy:
runs-on: ubuntu-latest
2024-02-02 16:04:27 +00:00
container:
volumes:
- /var/www:/www
2024-02-02 14:16:07 +00:00
steps:
- name: Clone code to runner
uses: actions/checkout@v4
- name: Move to directory
2024-02-02 16:52:06 +00:00
run: cd ${{ gitea.workspace }}
2024-02-02 14:16:07 +00:00
2024-02-02 14:23:12 +00:00
- name: Install dependencies
2024-02-02 14:27:06 +00:00
run: npm i
2024-02-02 14:16:07 +00:00
2024-02-02 14:23:12 +00:00
- name: Build 11ty site
2024-02-02 14:35:55 +00:00
run: npm run build
2024-02-02 14:23:12 +00:00
- name: Create folder if needed
2024-02-02 17:00:10 +00:00
run: if [ ! -d /www/${{ gitea.event.repository.name }} ]; then mkdir /www/${{ gitea.event.repository.name }}; fi
- name: Copy built website
2024-02-02 17:00:10 +00:00
run: cp -r _site/. /www/${{ gitea.event.repository.name }}
2024-02-02 16:16:29 +00:00
- name: Fix ownership
2024-02-02 17:00:10 +00:00
run: chown -R www-data:www-data /www/${{ gitea.event.repository.name }}