Add CI/CD
This commit is contained in:
parent
1a83f2a0d3
commit
cb29f90c69
1 changed files with 48 additions and 0 deletions
48
.forgejo/workflows/deploy.yaml
Normal file
48
.forgejo/workflows/deploy.yaml
Normal file
|
@ -0,0 +1,48 @@
|
|||
name: Deploy
|
||||
|
||||
on: [ push ]
|
||||
jobs:
|
||||
build:
|
||||
runs-on: docker
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cache Hugo binary
|
||||
id: cache-hugo
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: hugo
|
||||
key: ${{ runner.os }}-hugo
|
||||
|
||||
- name: Download Hugo
|
||||
if: steps.cache-hugo.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
curl -L -o hugo_0.140.0_linux-amd64.tar.gz https://github.com/gohugoio/hugo/releases/download/v0.140.0/hugo_0.140.0_linux-amd64.tar.gz
|
||||
tar zxvf hugo_0.140.0_linux-amd64.tar.gz
|
||||
|
||||
- name: Build website
|
||||
run: ./hugo
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: website
|
||||
path: public/
|
||||
|
||||
deploy:
|
||||
runs-on: docker
|
||||
steps:
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: website
|
||||
|
||||
- name: Install lftp
|
||||
run: |
|
||||
apt update
|
||||
apt install -y lftp
|
||||
|
||||
- name: Deploy website
|
||||
run: lftp -c "open -u ${{ secrets.FTP_USER }},${{ secrets.FTP_PASS }} ${{ secrets.FTP_HOST }}; mirror -R . ~/${{ secrets.FTP_DIR }}; quit"
|
Loading…
Add table
Add a link
Reference in a new issue