-
-
Notifications
You must be signed in to change notification settings - Fork 4
140 lines (129 loc) · 4.72 KB
/
next.yml
File metadata and controls
140 lines (129 loc) · 4.72 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: demo.plone.org/next build and deploy demo
on:
push:
branches:
- main
paths:
- "backend/**"
- "frontend-next/**"
- ".github/workflows/backend.yml"
- ".github/workflows/frontend.yml"
- ".github/workflows/next.yml"
- "devops/stacks/demo.plone.org_next.yml"
workflow_dispatch:
env:
IMAGE_NAME_PREFIX: ghcr.io/plone/demo-next
NODE_VERSION: "24.x"
PYTHON_VERSION: "3.12"
jobs:
config:
runs-on: ubuntu-latest
outputs:
backend: ${{ steps.filter.outputs.backend }}
frontend: ${{ steps.filter.outputs.frontend }}
BASE_TAG: ${{ steps.vars.outputs.BASE_TAG }}
IMAGE_NAME_PREFIX: ${{ env.IMAGE_NAME_PREFIX }}
NODE_VERSION: ${{ env.NODE_VERSION }}
PYTHON_VERSION: ${{ env.PYTHON_VERSION }}
PLONE_VERSION: ${{ steps.vars.outputs.PLONE_VERSION }}
VOLTO_VERSION: ${{ steps.vars.outputs.VOLTO_VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Compute several vars needed for the CI
id: vars
run: |
echo "BASE_TAG=sha-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "PLONE_VERSION=$(cat frontend-next/version.txt)" >> $GITHUB_OUTPUT
python3 -c 'import json; data = json.load(open("./frontend-next/mrs.developer.json")); print("VOLTO_VERSION=" + (data["core"].get("tag") or "latest"))' >> $GITHUB_OUTPUT
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
backend:
- 'backend/**'
- '.github/workflows/backend.yml'
- '.github/workflows/next.yml'
- 'frontend-next/version.txt'
frontend:
- 'frontend-next/**'
- '.github/workflows/frontend.yml'
- '.github/workflows/next.yml'
- name: Test vars
run: |
echo 'BASE_TAG=${{ steps.vars.outputs.BASE_TAG }}'
echo 'PLONE_VERSION=${{ steps.vars.outputs.PLONE_VERSION }}'
echo 'VOLTO_VERSION=${{ steps.vars.outputs.VOLTO_VERSION }}'
echo 'backend: ${{ steps.filter.outputs.backend }}'
echo 'frontend: ${{ steps.filter.outputs.frontend }}'
backend:
uses: ./.github/workflows/backend.yml
needs:
- config
with:
base-tag: ${{ needs.config.outputs.BASE_TAG }}
image-name-prefix: ${{ needs.config.outputs.IMAGE_NAME_PREFIX }}
image-name-suffix: backend
python-version: ${{ needs.config.outputs.PYTHON_VERSION }}
plone-version: ${{ needs.config.outputs.PLONE_VERSION }}
if: ${{ needs.config.outputs.backend == 'true' }}
permissions:
contents: read
packages: write
frontend:
uses: ./.github/workflows/frontend.yml
needs:
- config
with:
base-tag: ${{ needs.config.outputs.BASE_TAG }}
image-name-prefix: ${{ needs.config.outputs.IMAGE_NAME_PREFIX }}
image-name-suffix: frontend
node-version: ${{ needs.config.outputs.NODE_VERSION }}
volto-version: ${{ needs.config.outputs.VOLTO_VERSION }}
build-dir: frontend-next/
docker-file: Dockerfile
subpath-prefix: /next
if: ${{ needs.config.outputs.frontend == 'true' }}
permissions:
contents: read
packages: write
deploy:
runs-on: ubuntu-latest
if: ${{ always() && github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && !contains(needs.*.result, 'failure') }}
needs: [config, backend, frontend]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Deploy to cluster
uses: kitconcept/docker-stack-deploy@v1.2.0
with:
registry: "ghcr.io"
username: ${{ github.actor }}
password: ${{ secrets.DEPLOY_GHCR_READ_TOKEN }}
remote_host: ${{ vars.DEPLOY_HOST }}
remote_port: ${{ vars.DEPLOY_PORT }}
remote_user: ${{ vars.DEPLOY_USER }}
remote_private_key: ${{ secrets.DEPLOY_SSH }}
stack_file: devops/stacks/demo.plone.org_next.yml
stack_name: demo-plone-org-next
stack_param: latest
# env_file: |
# DB_PASSWORD="not used"
deploy_timeout: 480
report:
name: "Final report"
if: ${{ always() }}
runs-on: ubuntu-latest
needs:
- config
- frontend
- deploy
steps:
- name: Write report
run: |
echo '# Workflow Report' >> $GITHUB_STEP_SUMMARY
echo '| Job ID | Conclusion |' >> $GITHUB_STEP_SUMMARY
echo '| --- | --- |' >> $GITHUB_STEP_SUMMARY
echo '| config | ${{ needs.config.result }} |' >> $GITHUB_STEP_SUMMARY
# echo '| backend | ${{ needs.backend.result }} |' >> $GITHUB_STEP_SUMMARY
echo '| frontend | ${{ needs.frontend.result }} |' >> $GITHUB_STEP_SUMMARY