@@ -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."
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user