Skip to content

Commit cdac04c

Browse files
committed
Update github action for deployment robustness
- Add timeouts to stop never ending jobs eating up all our github credits - Ensure different branches / executions use a different artefact
1 parent 7d73476 commit cdac04c

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

docs/hypernode-deploy/getting-started/configure-ci-cd.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,11 @@ env:
105105
jobs:
106106
build:
107107
runs-on: ubuntu-latest
108+
timeout-minutes: 60
108109
# Here we use the latest Hypernode Deploy image with PHP 8.4 and Node.js 22
109110
container: quay.io/hypernode/deploy:latest-php8.4-node22
111+
outputs:
112+
safe_branch: ${{ steps.sanitize_branch.outputs.safe_branch }}
110113
steps:
111114
- uses: actions/checkout@v5
112115
- uses: actions/cache@v4
@@ -116,13 +119,20 @@ jobs:
116119
- uses: webfactory/ssh-agent@v0.9.1
117120
with:
118121
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
122+
- name: sanitize branch name
123+
id: sanitize_branch
124+
shell: bash
125+
run: |
126+
RAW="${GITHUB_REF_NAME}"
127+
SAFE="$(printf '%s' "$RAW" | sed -E 's/[^[:alnum:]._-]+/-/g; s/^-+//; s/-+$//')"
128+
echo "safe_branch=$SAFE" >> "$GITHUB_OUTPUT"
119129
- run: hypernode-deploy build -vvv
120130
env:
121131
DEPLOY_COMPOSER_AUTH: ${{ secrets.DEPLOY_COMPOSER_AUTH }}
122132
- name: archive production artifacts
123133
uses: actions/upload-artifact@v4
124134
with:
125-
name: deployment-build
135+
name: deployment-build-${{ steps.sanitize_branch.outputs.safe_branch }}
126136
path: build/build.tgz
127137
retention-days: 1
128138
```
@@ -140,14 +150,15 @@ jobs:
140150
deploy:
141151
needs: build
142152
runs-on: ubuntu-latest
143-
# Here we use the latest Hypernode Deploy image with PHP 8.4 and Node.js 22
153+
timeout-minutes: 60
154+
# Here we use the latest Hypernode Deploy image with PHP 8.4 and Node.js 22
144155
container: quay.io/hypernode/deploy:latest-php8.4-node22
145156
steps:
146157
- uses: actions/checkout@v5
147158
- name: download build artifact
148159
uses: actions/download-artifact@v5
149160
with:
150-
name: deployment-build
161+
name: deployment-build-${{ needs.build.outputs.safe_branch }}
151162
path: build/
152163
- uses: webfactory/ssh-agent@v0.9.1
153164
with:

0 commit comments

Comments
 (0)