Files
delta-force-guide-web/.gitea/workflows/build.yml
T
zihluwang 7343f68a4e ci: use scp/ssh instead of upload-artifact for Gitea Actions compatibility
GitHub's actions/upload-artifact is not supported on Gitea Actions.
Replaced with appleboy/scp-action to upload artifact to deploy server,
then download via appleboy/ssh-action in subsequent jobs.
2026-06-16 01:34:58 +08:00

91 lines
2.4 KiB
YAML

name: Build and Deploy
on:
release:
types: [published]
jobs:
build:
name: Build release archive
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 24
cache: pnpm
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 11
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build release archive
run: pnpm build:tar
- name: Upload artifact to server
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ vars.DEPLOY_HOST }}
username: ${{ vars.DEPLOY_USER }}
port: ${{ vars.DEPLOY_PORT }}
key: ${{ secrets.DEPLOY_SSH_KEY }}
source: "dist.tar.gz"
target: "/tmp/dist.tar.gz"
upload-release-asset:
name: Upload to Gitea Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifact from server
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ vars.DEPLOY_HOST }}
username: ${{ vars.DEPLOY_USER }}
port: ${{ vars.DEPLOY_PORT }}
key: ${{ secrets.DEPLOY_SSH_KEY }}
command: |
set -e
mkdir -p ~/.cache/gitea-artifacts
cp /tmp/dist.tar.gz ~/.cache/gitea-artifacts/
- name: Upload release asset
uses: https://gitea.com/actions/forgejo-release@v1
with:
direction: upload
files: ~/.cache/gitea-artifacts/dist.tar.gz
env:
FORGEJO_TOKEN: ${{ secrets.GITEA_TOKEN }}
deploy-to-server:
name: Deploy to onixbyte.cn
needs: build
runs-on: ubuntu-latest
steps:
- name: Extract archive and deploy
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ vars.DEPLOY_HOST }}
username: ${{ vars.DEPLOY_USER }}
port: ${{ vars.DEPLOY_PORT }}
key: ${{ secrets.DEPLOY_SSH_KEY }}
script_stop: true
script: |
set -e
DEPLOY_PATH="${{ vars.DEPLOY_PATH }}"
mkdir -p "$DEPLOY_PATH"
rm -rf "$DEPLOY_PATH"/*
tar -xzf /tmp/dist.tar.gz -C "$DEPLOY_PATH" --strip-components=1
chown -R caddy:caddy "$DEPLOY_PATH"
rm -f /tmp/dist.tar.gz