Files
blog/.gitea/workflows/build.yml
changsongd c0364ddf3d
Some checks failed
Gitea Actions Demo / build-and-deploy-to-local-server (push) Successful in 1m52s
Gitea Actions Demo / deploy-to-remote-server (push) Has been cancelled
v1
2025-06-10 21:59:14 +08:00

39 lines
1.7 KiB
YAML

name: Gitea Actions Demo
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
on: [push]
jobs:
build-and-deploy-to-local-server:
runs-on: ubuntu-latest
env:
HUGO_VERSION: '0.147.5'
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!"
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_linux-arm64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
- name: Check out repository code
run: |
echo "git clone ${{ gitea.server_url }}/${{ gitea.repository }} ."
git clone ${{ gitea.server_url }}/${{ gitea.repository }} .
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
- name: Build with Hugo
run: hugo
- name: Local Deploy
run: |
rm -rf /workspace/html/blog
mkdir -p /workspace/html/blog
cp -r public/* /workspace/html/blog/
- run: echo "🍏 This job's status is ${{ job.status }}."
deploy-to-remote-server:
needs: build-and-deploy-to-local-server
runs-on: mac
steps:
- name: Deploy to remote server
run: |
ssh -i /Users/konjacpotato/.ssh/id_rsa root@1970666.xyz "rm -rf /root/docker/docker-nginx/html/blog"
scp -i /Users/konjacpotato/.ssh/id_rsa -r /workspace/docker/docker-nginx/html/blog root@1970666.xyz:/root/docker/docker-nginx/html/