From 8b6dda08e66fbd6cbd20158fc12e3d5d9d3161fd Mon Sep 17 00:00:00 2001 From: Huarch Date: Thu, 23 Apr 2026 11:43:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20gitea=20=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Copilot --- .gitea/workflows/package.yml | 62 +++++++++++++++++++++++++++++++++++ .github/workflows/package.yml | 42 ------------------------ 2 files changed, 62 insertions(+), 42 deletions(-) create mode 100644 .gitea/workflows/package.yml delete mode 100644 .github/workflows/package.yml diff --git a/.gitea/workflows/package.yml b/.gitea/workflows/package.yml new file mode 100644 index 0000000..5383db3 --- /dev/null +++ b/.gitea/workflows/package.yml @@ -0,0 +1,62 @@ +name: Build Push and Deploy + +on: + push: + tags: + - "v*" + +jobs: + docker-image: + runs-on: ubuntu + permissions: + contents: read + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Gitea Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ secrets.REGISTRY_HOST }} + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + + - name: Build and Push Image + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + push: true + tags: | + ${{ secrets.REGISTRY_HOST }}/${{ github.repository }}:${{ github.ref_name }} + ${{ secrets.REGISTRY_HOST }}/${{ github.repository }}:latest + build-args: | + NEXT_PUBLIC_BACKEND_URL=${{ secrets.NEXT_PUBLIC_BACKEND_URL }} + NEXT_PUBLIC_MAP_URL=${{ secrets.NEXT_PUBLIC_MAP_URL }} + NEXT_PUBLIC_MAP_WORKSPACE=${{ secrets.NEXT_PUBLIC_MAP_WORKSPACE }} + NEXT_PUBLIC_MAP_EXTENT=${{ secrets.NEXT_PUBLIC_MAP_EXTENT }} + NEXT_PUBLIC_NETWORK_NAME=${{ secrets.NEXT_PUBLIC_NETWORK_NAME }} + NEXT_PUBLIC_MAPBOX_TOKEN=${{ secrets.NEXT_PUBLIC_MAPBOX_TOKEN }} + NEXT_PUBLIC_TIANDITU_TOKEN=${{ secrets.NEXT_PUBLIC_TIANDITU_TOKEN }} + + - name: Notify Deploy Server + if: success() + env: + IMAGE: ${{ secrets.REGISTRY_HOST }}/${{ github.repository }}:${{ github.ref_name }} + run: | + curl -fsSL -X POST "${{ secrets.DEPLOY_WEBHOOK_URL }}" \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer ${{ secrets.DEPLOY_WEBHOOK_TOKEN }}" \ + -d "{\"image\":\"${IMAGE}\",\"tag\":\"${{ github.ref_name }}\",\"repo\":\"${{ github.repository }}\"}" + + deploy-fallback-log: + runs-on: ubuntu + needs: docker-image + if: failure() + steps: + - name: Deployment not triggered + run: echo "Image build/push failed, deployment webhook was not called." diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml deleted file mode 100644 index e110f47..0000000 --- a/.github/workflows/package.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Build and Lint - -on: - push: - tags: - - "v*" - -jobs: - build: - runs-on: ubuntu-latest - env: - FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true - strategy: - matrix: - node-version: [24.x] - - steps: - - uses: actions/checkout@v4 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - cache: "npm" - - - name: Install dependencies - run: npm ci - - - name: Package Source Code - run: | - tar --warning=no-file-changed -czf source-code.tar.gz \ - --exclude='node_modules' \ - --exclude='.next' \ - --exclude='dist' \ - --exclude='source-code.tar.gz' \ - . - - - name: Upload Source Artifact - uses: actions/upload-artifact@v4 - with: - name: source-code - path: source-code.tar.gz