Skip to content

Commit 24bbe5b

Browse files
Add IONOS Deploy Now workflow
1 parent 45ed125 commit 24bbe5b

File tree

3 files changed

+235
-0
lines changed

3 files changed

+235
-0
lines changed
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# Please do not edit this file.
2+
# More information under https://docs.ionos.space/docs/github-actions-customization/
3+
# version: 2022-07-21
4+
5+
name: "Deploy Now: Deploy to IONOS"
6+
7+
on:
8+
workflow_dispatch:
9+
inputs:
10+
version:
11+
required: true
12+
type: string
13+
project-id:
14+
required: true
15+
type: string
16+
branch-id:
17+
required: true
18+
type: string
19+
deployment-ids:
20+
require: true
21+
type: string
22+
push:
23+
path:
24+
- ./.github/workflows/deploy-to-ionos.yaml
25+
26+
concurrency: ${{ github.ref }}
27+
28+
jobs:
29+
deploy-to-ionos:
30+
if: ${{ github.event_name == 'workflow_dispatch' }}
31+
runs-on: ubuntu-latest
32+
permissions:
33+
actions: read
34+
strategy:
35+
matrix:
36+
deployment-id: ${{ fromJson(inputs.deployment-ids) }}
37+
steps:
38+
- name: Update deployment status
39+
uses: ionos-deploy-now/project-action@v1
40+
with:
41+
api-key: ${{ secrets.IONOS_API_KEY }}
42+
service-host: api-eu.ionos.space
43+
project-id: ${{ inputs.project-id }}
44+
branch-id: ${{ inputs.branch-id }}
45+
deployment-id: ${{ matrix.deployment-id }}
46+
action: update-status
47+
status: in_progress
48+
49+
- name: Retrieve stored deployment
50+
uses: ionos-deploy-now/artifact-action@v1
51+
with:
52+
api-key: ${{ secrets.IONOS_API_KEY }}
53+
service-host: api-eu.ionos.space
54+
project-id: ${{ inputs.project-id }}
55+
branch-id: ${{ inputs.branch-id }}
56+
version: ${{ inputs.version }}
57+
action: download
58+
59+
- name: Fetch deployment info
60+
uses: ionos-deploy-now/project-action@v1
61+
id: deployment
62+
with:
63+
api-key: ${{ secrets.IONOS_API_KEY }}
64+
service-host: api-eu.ionos.space
65+
project-id: ${{ inputs.project-id }}
66+
branch-id: ${{ inputs.branch-id }}
67+
deployment-id: ${{ matrix.deployment-id }}
68+
action: retrieve-info
69+
70+
- name: Render templates
71+
uses: ionos-deploy-now/template-renderer-action@v2
72+
id: template
73+
with:
74+
deployment-id: ${{ matrix.deployment-id }}
75+
data: "[${{ steps.deployment.outputs.template-variables }}, ${{ toJson(secrets) }}]"
76+
input-directory: deployment
77+
output-directory: deployment
78+
intermediate-data-file: deployment/.template-renderer-data
79+
80+
- name: Render real site-url to all files
81+
run: |
82+
for file in `grep -rl 'https://IONOS_DEPLOY_NOW_SITE_URL' .`; do
83+
sed -i $file -e 's|https://IONOS_DEPLOY_NOW_SITE_URL|${{ fromJson(steps.deployment.outputs.info).site-url }}|g'
84+
done
85+
86+
- name: Render SSH user secret name
87+
run: echo SSH_USERNAME_SECRET=IONOS_DEPLOYMENT_`echo ${{ matrix.deployment-id }} | tr '[:lower:]' '[:upper:]' | tr '-' '_'`_SSH_USERNAME >> $GITHUB_ENV
88+
89+
- name: Deploy to IONOS
90+
uses: ionos-deploy-now/deploy-to-ionos-action@v2
91+
with:
92+
api-key: ${{ secrets.IONOS_API_KEY }}
93+
service-host: api-eu.ionos.space
94+
project-id: ${{ inputs.project-id }}
95+
branch-id: ${{ inputs.branch-id }}
96+
deployment-id: ${{ matrix.deployment-id }}
97+
deployment-info: ${{ steps.deployment.outputs.info }}
98+
ssh-user: ${{ secrets[env.SSH_USERNAME_SECRET] }}
99+
ssh-key: ${{ secrets.IONOS_SSH_KEY }}
100+
101+
- name: Update deployment status
102+
if: ${{ always() }}
103+
uses: ionos-deploy-now/project-action@v1
104+
with:
105+
api-key: ${{ secrets.IONOS_API_KEY }}
106+
service-host: api-eu.ionos.space
107+
project-id: ${{ inputs.project-id }}
108+
branch-id: ${{ inputs.branch-id }}
109+
deployment-id: ${{ matrix.deployment-id }}
110+
action: update-status
111+
status: ${{ job.status }}
112+
113+
notify-deployment-finished:
114+
needs: deploy-to-ionos
115+
if: ${{ github.event_name == 'workflow_dispatch' && always() }}
116+
runs-on: ubuntu-latest
117+
steps:
118+
- name: Notify all deployments finished
119+
uses: ionos-deploy-now/project-action@v1
120+
with:
121+
api-key: ${{ secrets.IONOS_API_KEY }}
122+
service-host: api-eu.ionos.space
123+
project-id: ${{ inputs.project-id }}
124+
branch-id: ${{ inputs.branch-id }}
125+
action: set-deployments-finished
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# To better understand this file read this:
2+
# https://docs.ionos.space/docs/github-actions-customization/
3+
4+
name: "Deploy Now: Execute Build"
5+
6+
on:
7+
workflow_call:
8+
inputs:
9+
site-url:
10+
required: true
11+
type: string
12+
branch-id:
13+
required: true
14+
type: string
15+
16+
env:
17+
DEPLOYMENT_FOLDER: dist
18+
19+
jobs:
20+
# Please do not rename this job
21+
build-project:
22+
name: build https-github.com-base44dev-fs-ai
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: checkout
26+
uses: actions/checkout@v4
27+
with:
28+
submodules: 'recursive'
29+
30+
- name: Setup Node
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: v22.x
34+
35+
- name: Build Node assets
36+
env:
37+
CI: true
38+
SITE_URL: ${{ inputs.site-url }}
39+
run: |
40+
npm install --global pnpm
41+
pnpm install
42+
pnpm build
43+
44+
# Please do not touch the following action
45+
- name: Store deployment content
46+
uses: ionos-deploy-now/artifact-action@v1
47+
with:
48+
api-key: ${{ secrets.IONOS_API_KEY }}
49+
service-host: api-eu.ionos.space
50+
project-id: ef6b6dcc-61ec-45e6-b56a-5f824ecde83c
51+
branch-id: ${{ inputs.branch-id }}
52+
version: ${{ github.sha }}
53+
folder: ${{ env.DEPLOYMENT_FOLDER }}
54+
config-file: .deploy-now/https-github.com-base44dev-fs-ai/config.yaml
55+
action: upload
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Please do not edit this file.
2+
# Build steps can be customized in the https-github.com-base44dev-fs-ai-build.yaml.
3+
# More information under https://docs.ionos.space/docs/github-actions-customization/
4+
# version: 2022-07-21
5+
6+
name: "Deploy Now: Orchestration"
7+
run-name: "Deploy Now: Build https-github.com-base44dev-fs-ai · ${{ github.event.head_commit.message || format('Triggered by {0}', github.triggering_actor) }}"
8+
9+
on:
10+
- push
11+
- workflow_dispatch
12+
13+
jobs:
14+
retrieve-project:
15+
name: check readiness
16+
runs-on: ubuntu-latest
17+
outputs:
18+
deployment-enabled: ${{ fromJson(steps.project.outputs.info).deployment-enabled }}
19+
branch-id: ${{ fromJson(steps.project.outputs.info).branch-id }}
20+
steps:
21+
- name: Fetch project data
22+
uses: ionos-deploy-now/project-action@v1
23+
id: project
24+
with:
25+
api-key: ${{ secrets.IONOS_API_KEY }}
26+
service-host: api-eu.ionos.space
27+
project-id: ef6b6dcc-61ec-45e6-b56a-5f824ecde83c
28+
action: retrieve-info
29+
30+
31+
build:
32+
name: build
33+
needs: retrieve-project
34+
if: ${{ needs.retrieve-project.outputs.deployment-enabled == 'true' }}
35+
uses: ./.github/workflows/https-github.com-base44dev-fs-ai-build.yaml
36+
with:
37+
site-url: https://IONOS_DEPLOY_NOW_SITE_URL
38+
branch-id: ${{ needs.retrieve-project.outputs.branch-id }}
39+
secrets: inherit
40+
41+
deploy:
42+
name: trigger deployment
43+
needs:
44+
- retrieve-project
45+
- build
46+
runs-on: ubuntu-latest
47+
steps:
48+
- name: Dispatch deployment(s)
49+
uses: ionos-deploy-now/project-action@v1
50+
with:
51+
api-key: ${{ secrets.IONOS_API_KEY }}
52+
service-host: api-eu.ionos.space
53+
project-id: ef6b6dcc-61ec-45e6-b56a-5f824ecde83c
54+
branch-id: ${{ needs.retrieve-project.outputs.branch-id }}
55+
action: dispatch-deployments

0 commit comments

Comments
 (0)