-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Deployer | ||
run-name: Build and deploy zoug.fr | ||
on: | ||
push: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
environment: Deployer | ||
steps: | ||
- name: Checkout the current branch | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Create .ssh folder for runner | ||
run: mkdir ~/.ssh && chmod 700 ~/.ssh | ||
|
||
- name: Copy private key to file | ||
env: | ||
PRIVKEY: ${{ secrets.CI_SSH_PRIVKEY }} | ||
run: echo "$PRIVKEY" > ~/.ssh/id_ed25519 && chmod 500 ~/.ssh/id_ed25519 | ||
|
||
- name: Scan the host key | ||
env: | ||
HOST: ${{ secrets.CI_SSH_HOSTNAME }} | ||
run: ssh-keyscan $HOST > ~/.ssh/known_hosts | ||
|
||
- name: Install Zola | ||
run: sudo snap install zola --edge | ||
|
||
- name: Build the website | ||
run: zola build | ||
|
||
- name: Deploy the website | ||
env: | ||
USER: ${{ secrets.CI_SSH_USER }} | ||
HOST: ${{ secrets.CI_SSH_HOSTNAME }} | ||
run: rsync -avx -e "ssh -i ~/.ssh/id_ed25519" --delete --exclude '.ssh' public/ $USER@$HOST:./ |