-
Notifications
You must be signed in to change notification settings - Fork 2
78 lines (68 loc) · 2.34 KB
/
Copy pathdeploy.yml
File metadata and controls
78 lines (68 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Deploy (manual)
on:
workflow_dispatch:
inputs:
environment:
description: "Target environment name"
default: "production"
required: true
jobs:
build-artifacts:
name: Build Client & Package Server
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install client deps
working-directory: proj2/Ecobites/client
run: |
if [ -f package-lock.json ]; then npm ci; else npm i; fi
- name: Build client
working-directory: proj2/Ecobites/client
run: npm run build
- name: Upload client dist artifact
uses: actions/upload-artifact@v4
with:
name: client-dist-${{ github.sha }}
path: proj2/Ecobites/client/dist
- name: Install server deps
working-directory: proj2/Ecobites/server
run: |
if [ -f package-lock.json ]; then npm ci --only=production; else npm i --omit=dev; fi
- name: Package server (zip)
working-directory: proj2/Ecobites/server
run: |
zip -r server-${{ github.sha }}.zip src package.json package-lock.json jest.config.js || true
- name: Upload server package artifact
uses: actions/upload-artifact@v4
with:
name: server-package-${{ github.sha }}
path: proj2/Ecobites/server/server-${{ github.sha }}.zip
# Optional: push server image to GHCR (requires Dockerfile and uncommented steps)
# server-container:
# name: Build & Push Server Image (GHCR)
# runs-on: ubuntu-latest
# needs: build-artifacts
# permissions:
# contents: read
# packages: write
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Login to GHCR
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: Build & Push
# uses: docker/build-push-action@v6
# with:
# context: proj2/Ecobites/server
# push: true
# tags: ghcr.io/${{ github.repository }}-server:latest,ghcr.io/${{ github.repository }}-server:${{ github.sha }}