8 Commits

Author SHA1 Message Date
zihluwang d0165476ca Merge pull request 'ci: clean up old artifact before uploading to server' (#8) from develop into main
Build and Deploy / Build release archive (release) Failing after 47s
Build and Deploy / Upload to Gitea Release (release) Has been skipped
Build and Deploy / Deploy to onixbyte.cn (release) Has been skipped
Reviewed-on: https://git.onixbyte.com/onixbyte/delta-force-guide-web/pulls/8
2026-06-17 00:17:55 +08:00
zihluwang f1393088a4 ci: clean up old artifact before uploading to server 2026-06-17 00:16:23 +08:00
zihluwang 2852cb7e38 Merge pull request 'ci: fix release pipeline upload and deploy' (#7) from develop into main
Build and Deploy / Build release archive (release) Failing after 52s
Build and Deploy / Upload to Gitea Release (release) Has been skipped
Build and Deploy / Deploy to onixbyte.cn (release) Has been skipped
Reviewed-on: https://git.onixbyte.com/onixbyte/delta-force-guide-web/pulls/7
2026-06-17 00:09:59 +08:00
siujamo e4aa5b988b ci: fix release pipeline upload and deploy
- scp target restored to /tmp/: /tmp/dist.tar.gz was treated as a
  directory by scp-action, breaking the deploy tar extract
- drop forgejo-release@v1 (unreachable from runner); upload asset
  via the Gitea release assets API using curl
- replace ssh-action "cp" with scp CLI: the cp ran on the remote
  server, leaving the runner without a local file
- chain deploy on upload-release-asset: its cleanup rm must not
  race with the artifact download
- clean up stale /tmp/dist.tar.gz on the server before each build
2026-06-16 11:22:56 +08:00
zihluwang a4794e7273 Merge pull request 'ci: use scp/ssh instead of upload-artifact for Gitea Actions compatibility' (#6) from develop into main
Build and Deploy / Build release archive (release) Successful in 46s
Build and Deploy / Upload to Gitea Release (release) Failing after 5s
Build and Deploy / Deploy to onixbyte.cn (release) Failing after 10s
Reviewed-on: https://git.onixbyte.com/onixbyte/delta-force-guide-web/pulls/6
2026-06-16 01:36:07 +08:00
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
siujamo 04a282dd5e Merge pull request 'ci: use node 24 in build workflow' (#4) from develop into main
Build and Deploy / Build release archive (release) Failing after 35s
Build and Deploy / Upload to Gitea Release (release) Has been skipped
Build and Deploy / Deploy to onixbyte.cn (release) Has been skipped
Reviewed-on: https://git.onixbyte.com/onixbyte/delta-force-guide-web/pulls/4
2026-06-15 17:03:07 +08:00
siujamo 782974f96d ci: use node 24 in build workflow 2026-06-15 17:02:14 +08:00
+55 -38
View File
@@ -16,7 +16,7 @@ jobs:
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 24
cache: pnpm cache: pnpm
- name: Setup pnpm - name: Setup pnpm
@@ -30,44 +30,16 @@ jobs:
- name: Build release archive - name: Build release archive
run: pnpm build:tar run: pnpm build:tar
- name: Upload build artifact - name: Clean up previous build artifacts on server
uses: actions/upload-artifact@v4 uses: appleboy/ssh-action@v1.0.3
with: with:
name: dist-archive host: ${{ vars.DEPLOY_HOST }}
path: dist.tar.gz username: ${{ vars.DEPLOY_USER }}
retention-days: 1 port: ${{ vars.DEPLOY_PORT }}
key: ${{ secrets.DEPLOY_SSH_KEY }}
command: rm -f /tmp/dist.tar.gz /tmp/*.tar.gz
upload-release-asset: - name: Upload artifact to server
name: Upload to Gitea Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: dist-archive
- name: Upload release asset
uses: https://gitea.com/actions/forgejo-release@v1
with:
direction: upload
files: 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: Download build artifact
uses: actions/download-artifact@v4
with:
name: dist-archive
- name: Upload archive to server
uses: appleboy/scp-action@v0.1.7 uses: appleboy/scp-action@v0.1.7
with: with:
host: ${{ vars.DEPLOY_HOST }} host: ${{ vars.DEPLOY_HOST }}
@@ -77,7 +49,52 @@ jobs:
source: "dist.tar.gz" source: "dist.tar.gz"
target: "/tmp/" target: "/tmp/"
- name: Extract archive and set ownership upload-release-asset:
name: Upload to Gitea Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifact from server
env:
DEPLOY_HOST: ${{ vars.DEPLOY_HOST }}
DEPLOY_USER: ${{ vars.DEPLOY_USER }}
DEPLOY_PORT: ${{ vars.DEPLOY_PORT }}
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
run: |
set -e
SSH_DIR="${RUNNER_TEMP}/ssh"
mkdir -p "$SSH_DIR"
chmod 700 "$SSH_DIR"
printf '%s\n' "$DEPLOY_SSH_KEY" > "$SSH_DIR/key"
chmod 600 "$SSH_DIR/key"
scp -i "$SSH_DIR/key" \
-P "$DEPLOY_PORT" \
-o StrictHostKeyChecking=accept-new \
-o UserKnownHostsFile="$SSH_DIR/known_hosts" \
"${DEPLOY_USER}@${DEPLOY_HOST}:/tmp/dist.tar.gz" \
./dist.tar.gz
rm -rf "$SSH_DIR"
- name: Upload release asset via Gitea API
run: |
set -e
RELEASE_ID=$(jq -r '.release.id' "$GITEA_EVENT_PATH")
URL="${GITEA_SERVER_URL}/api/v1/repos/${GITEA_REPOSITORY}/releases/${RELEASE_ID}/assets?name=dist.tar.gz"
curl -fsSL \
-X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/gzip" \
--data-binary "@dist.tar.gz" \
"${URL}"
deploy-to-server:
name: Deploy to onixbyte.cn
needs: [build, upload-release-asset]
runs-on: ubuntu-latest
steps:
- name: Extract archive and deploy
uses: appleboy/ssh-action@v1.0.3 uses: appleboy/ssh-action@v1.0.3
with: with:
host: ${{ vars.DEPLOY_HOST }} host: ${{ vars.DEPLOY_HOST }}