45 lines
1.2 KiB
YAML
45 lines
1.2 KiB
YAML
name: Deploy Nuxt App
|
|
on: [push]
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
with:
|
|
token: ${{ secrets.TOKEN }}
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: '22'
|
|
|
|
- name: Install dependencies and build
|
|
run: |
|
|
npm install
|
|
npm run build
|
|
|
|
- name: Prepare deployment files
|
|
run: |
|
|
tar -czf deploy.tar.gz dist Dockerfile docker-compose.yml
|
|
|
|
- name: Upload files via Gitea API
|
|
env:
|
|
GITEA_API: "https://gitea.miduway.space/api/v1/repos/levis/ebook/raw/main"
|
|
GITEA_TOKEN: ${{ secrets.TOKEN }}
|
|
run: |
|
|
for file in Dockerfile docker-compose.yml; do
|
|
curl -X PUT \
|
|
-H "Authorization: token $TOKEN" \
|
|
-H "Content-Type: text/plain" \
|
|
-T "$file" \
|
|
"$GITEA_API/$file?branch=main"
|
|
done
|
|
|
|
curl -X PUT \
|
|
-H "Authorization: token $TOKEN" \
|
|
-H "Content-Type: application/gzip" \
|
|
-T "deploy.tar.gz" \
|
|
"$GITEA_API/deploy.tar.gz?branch=main"
|