Compare commits
3 Commits
99b40359e9
...
cda2d41067
| Author | SHA1 | Date | |
|---|---|---|---|
| cda2d41067 | |||
| 9b92390d63 | |||
| b6b420f754 |
73
.gitea/workflows/build_and_deploy.yaml
Normal file
73
.gitea/workflows/build_and_deploy.yaml
Normal file
@@ -0,0 +1,73 @@
|
||||
name: Build and Deploy Zola Site
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main # Or whichever branch you want to deploy from
|
||||
|
||||
jobs:
|
||||
#----------------------------------------------------
|
||||
# JOB 1: Build the static site with Zola
|
||||
#----------------------------------------------------
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# Step 1: Check out the main website repository's code
|
||||
- name: Checkout Website Source
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: main-site
|
||||
|
||||
# Step 2: Check out the theme repository into the correct folder
|
||||
# Replace 'YourUsername/YourThemeRepo' with your actual Gitea theme repository
|
||||
- name: Checkout Theme
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: finmoon/moon-anemone
|
||||
path: main-site/themes/anemone
|
||||
|
||||
# Step 3: Install the Zola static site generator
|
||||
- name: Install Zola
|
||||
uses: taiki-e/install-action@v2
|
||||
with:
|
||||
tool: zola
|
||||
|
||||
# Step 4: Run the build command
|
||||
# Zola will generate the site in the 'main-site/public' directory
|
||||
- name: Build Site
|
||||
run: |
|
||||
cd main-site
|
||||
zola build
|
||||
|
||||
# Step 5: Upload the 'public' directory as an artifact
|
||||
# This makes the build output available to other jobs (like our deploy job)
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: zola-public
|
||||
path: main-site/public/
|
||||
|
||||
#----------------------------------------------------
|
||||
# JOB 2: Deploy the built site to the web server
|
||||
#----------------------------------------------------
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
# Step 1: Download the artifact from the 'build' job
|
||||
- name: Download artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: zola-public
|
||||
|
||||
# Step 2: Copy the files to the web server using SCP
|
||||
- name: SCP files to server
|
||||
uses: appleboy/scp-action@master
|
||||
with:
|
||||
host: ${{ secrets.SSH_HOST }}
|
||||
username: ${{ secrets.SSH_USERNAME }}
|
||||
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
source: "./*" # Copies the content of the downloaded artifact directory
|
||||
target: "/var/www/html/finmoon" # The document root on your Apache server
|
||||
strip_components: 1 # Removes the top-level directory from the source path
|
||||
rm: true # Removes existing files in the target directory before copying
|
||||
@@ -1,19 +0,0 @@
|
||||
name: Gitea Actions Demo
|
||||
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
Explore-Gitea-Actions:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event"
|
||||
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
||||
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
|
||||
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
|
||||
- name: List files in the repository
|
||||
run: |
|
||||
ls ${{ gitea.workspace }}
|
||||
- run: echo "🍏 This job's status is ${{ job.status }}."
|
||||
Reference in New Issue
Block a user