From cdac04cc7ef40baecd00f66621506c2be3ff9939 Mon Sep 17 00:00:00 2001 From: Luke Rodgers Date: Thu, 16 Oct 2025 16:18:00 +0100 Subject: [PATCH 1/3] 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 --- .../getting-started/configure-ci-cd.md | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/docs/hypernode-deploy/getting-started/configure-ci-cd.md b/docs/hypernode-deploy/getting-started/configure-ci-cd.md index c6032959..71dd46b2 100644 --- a/docs/hypernode-deploy/getting-started/configure-ci-cd.md +++ b/docs/hypernode-deploy/getting-started/configure-ci-cd.md @@ -105,8 +105,11 @@ env: jobs: build: runs-on: ubuntu-latest + timeout-minutes: 60 # Here we use the latest Hypernode Deploy image with PHP 8.4 and Node.js 22 container: quay.io/hypernode/deploy:latest-php8.4-node22 + outputs: + safe_branch: ${{ steps.sanitize_branch.outputs.safe_branch }} steps: - uses: actions/checkout@v5 - uses: actions/cache@v4 @@ -116,13 +119,20 @@ jobs: - uses: webfactory/ssh-agent@v0.9.1 with: ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + - name: sanitize branch name + id: sanitize_branch + shell: bash + run: | + RAW="${GITHUB_REF_NAME}" + SAFE="$(printf '%s' "$RAW" | sed -E 's/[^[:alnum:]._-]+/-/g; s/^-+//; s/-+$//')" + echo "safe_branch=$SAFE" >> "$GITHUB_OUTPUT" - run: hypernode-deploy build -vvv env: DEPLOY_COMPOSER_AUTH: ${{ secrets.DEPLOY_COMPOSER_AUTH }} - name: archive production artifacts uses: actions/upload-artifact@v4 with: - name: deployment-build + name: deployment-build-${{ steps.sanitize_branch.outputs.safe_branch }} path: build/build.tgz retention-days: 1 ``` @@ -140,14 +150,15 @@ jobs: deploy: needs: build runs-on: ubuntu-latest - # Here we use the latest Hypernode Deploy image with PHP 8.4 and Node.js 22 + timeout-minutes: 60 + # Here we use the latest Hypernode Deploy image with PHP 8.4 and Node.js 22 container: quay.io/hypernode/deploy:latest-php8.4-node22 steps: - uses: actions/checkout@v5 - name: download build artifact uses: actions/download-artifact@v5 with: - name: deployment-build + name: deployment-build-${{ needs.build.outputs.safe_branch }} path: build/ - uses: webfactory/ssh-agent@v0.9.1 with: From 4f914db2ce4655ce05ccb06bc87be15b40bc12ee Mon Sep 17 00:00:00 2001 From: Luke Rodgers Date: Thu, 16 Oct 2025 16:26:43 +0100 Subject: [PATCH 2/3] Fix whitespace --- docs/hypernode-deploy/getting-started/configure-ci-cd.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/hypernode-deploy/getting-started/configure-ci-cd.md b/docs/hypernode-deploy/getting-started/configure-ci-cd.md index 71dd46b2..6dafa68d 100644 --- a/docs/hypernode-deploy/getting-started/configure-ci-cd.md +++ b/docs/hypernode-deploy/getting-started/configure-ci-cd.md @@ -151,7 +151,7 @@ jobs: needs: build runs-on: ubuntu-latest timeout-minutes: 60 - # Here we use the latest Hypernode Deploy image with PHP 8.4 and Node.js 22 + # Here we use the latest Hypernode Deploy image with PHP 8.4 and Node.js 22 container: quay.io/hypernode/deploy:latest-php8.4-node22 steps: - uses: actions/checkout@v5 From e11736cf418bc85a24b16fea5acae0d6b4b55357 Mon Sep 17 00:00:00 2001 From: Luke Rodgers Date: Thu, 16 Oct 2025 16:46:18 +0100 Subject: [PATCH 3/3] Edit workflow --- .../getting-started/configure-ci-cd.md | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/docs/hypernode-deploy/getting-started/configure-ci-cd.md b/docs/hypernode-deploy/getting-started/configure-ci-cd.md index 6dafa68d..ef6329de 100644 --- a/docs/hypernode-deploy/getting-started/configure-ci-cd.md +++ b/docs/hypernode-deploy/getting-started/configure-ci-cd.md @@ -108,8 +108,6 @@ jobs: timeout-minutes: 60 # Here we use the latest Hypernode Deploy image with PHP 8.4 and Node.js 22 container: quay.io/hypernode/deploy:latest-php8.4-node22 - outputs: - safe_branch: ${{ steps.sanitize_branch.outputs.safe_branch }} steps: - uses: actions/checkout@v5 - uses: actions/cache@v4 @@ -119,20 +117,13 @@ jobs: - uses: webfactory/ssh-agent@v0.9.1 with: ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - - name: sanitize branch name - id: sanitize_branch - shell: bash - run: | - RAW="${GITHUB_REF_NAME}" - SAFE="$(printf '%s' "$RAW" | sed -E 's/[^[:alnum:]._-]+/-/g; s/^-+//; s/-+$//')" - echo "safe_branch=$SAFE" >> "$GITHUB_OUTPUT" - run: hypernode-deploy build -vvv env: DEPLOY_COMPOSER_AUTH: ${{ secrets.DEPLOY_COMPOSER_AUTH }} - name: archive production artifacts uses: actions/upload-artifact@v4 with: - name: deployment-build-${{ steps.sanitize_branch.outputs.safe_branch }} + name: deployment-build path: build/build.tgz retention-days: 1 ``` @@ -158,7 +149,7 @@ jobs: - name: download build artifact uses: actions/download-artifact@v5 with: - name: deployment-build-${{ needs.build.outputs.safe_branch }} + name: deployment-build path: build/ - uses: webfactory/ssh-agent@v0.9.1 with: