This commit is contained in:
@ -1,4 +1,4 @@
|
||||
name: Deploy Application
|
||||
name: Deploy Nuxt App
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
@ -8,27 +8,37 @@ jobs:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
token: 0406afe7de6547e850dd62c84976c6def23a5193
|
||||
token: ${{ secrets.TOKEN }}
|
||||
|
||||
- name: Install curl
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '22'
|
||||
|
||||
- name: Install dependencies and build
|
||||
run: |
|
||||
if command -v apt-get &> /dev/null; then
|
||||
apt-get update && apt-get install -y curl
|
||||
elif command -v apk &> /dev/null; then
|
||||
apk add --no-cache curl
|
||||
elif command -v yum &> /dev/null; then
|
||||
yum install -y curl
|
||||
fi
|
||||
npm install
|
||||
npm run build
|
||||
|
||||
- name: Upload config files to server
|
||||
- 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: "0406afe7de6547e850dd62c84976c6def23a5193"
|
||||
GITEA_API: "https://gitea.miduway.space/api/v1/repos/levis/ebook/raw/production"
|
||||
GITEA_TOKEN: ${{ secrets.TOKEN }}
|
||||
run: |
|
||||
for file in docker-compose.yml Dockerfile; do
|
||||
echo "Uploading $file"
|
||||
for file in Dockerfile docker-compose.yml; do
|
||||
curl -X PUT \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Authorization: token $TOKEN" \
|
||||
-H "Content-Type: text/plain" \
|
||||
-T "$file" \
|
||||
"$GITEA_API/$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"
|
||||
|
Reference in New Issue
Block a user