From 773468a84de484bce43108bd5ea595e0ed84ebf2 Mon Sep 17 00:00:00 2001 From: June Date: Sat, 26 Jul 2025 16:04:25 +0200 Subject: [PATCH 1/3] debugging --- .forgejo/workflows/deploy.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.forgejo/workflows/deploy.yaml b/.forgejo/workflows/deploy.yaml index f0bfb13..bea53f2 100644 --- a/.forgejo/workflows/deploy.yaml +++ b/.forgejo/workflows/deploy.yaml @@ -18,6 +18,18 @@ jobs: - name: Pipeline info run: | echo "Run triggered by ${{ github.event_name }} (${{ github.event.action }}) on ref ${{ github.ref_name }}" + - name: debugging + run: | + echo "github.event_name ${{ github.event_name }}" + echo "forge.event_name ${{ forge.event_name }}" + echo "github.event.action ${{ github.event.action }}" + echo "forge.event.action ${{ forge.event.action }}" + echo "github.ref_name ${{ github.ref_name }}" + echo "forge.ref_name ${{ forge.ref_name }}" + echo "github.ref ${{ github.ref }}" + echo "forge.ref ${{ forge.ref }}" + echo "github.repository ${{ github.repository }}" + echo "forge.repository ${{ forge.repository }}" build: runs-on: docker From cb089a6d0590a0578699d2259d2d38436749ec36 Mon Sep 17 00:00:00 2001 From: June Date: Sat, 26 Jul 2025 16:11:02 +0200 Subject: [PATCH 2/3] ci: make step conditions more structured Either have a step always be executed, be executed for prod or be executed for a PR (staging) and use the same conditions for each of these cases. --- .forgejo/workflows/deploy.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/deploy.yaml b/.forgejo/workflows/deploy.yaml index f0bfb13..a2f1716 100644 --- a/.forgejo/workflows/deploy.yaml +++ b/.forgejo/workflows/deploy.yaml @@ -39,12 +39,13 @@ jobs: fetch-depth: 0 # pull full history for page lastmod by git commit date - name: Build website - prod + if: (github.event_name == 'push' || github.event_name == 'schedule') && github.ref_name == 'main' run: | ./fetch-calendar.sh hugo - name: Build website - staging - if: github.ref_name != 'main' + if: github.event_name == 'pull_request' run: | sed -i "s#baseURL = 'https://hamburg.ccc.de/'#baseURL = 'https://staging.hamburg.ccc.de/pr${{ github.event.pull_request.number }}/'#" hugo.toml sed -i "s#index = true#index = false#" hugo.toml @@ -53,7 +54,6 @@ jobs: hugo --buildFuture - name: Deploy - Prepare keys - if: github.event_name == 'push' || github.event_name == 'pull_request' || github.event_name == 'schedule' run: | echo "${{ secrets.SSH_DEPLOY_KEY }}" > deploykey.priv chmod 400 deploykey.priv From bc1ec31f4436e9f6a5b10c63d1e5c4ec8b2ee2dc Mon Sep 17 00:00:00 2001 From: June Date: Sat, 26 Jul 2025 16:22:44 +0200 Subject: [PATCH 3/3] wip: ci: factor out deployment into separate steps for better org. --- .forgejo/workflows/deploy.yaml | 43 ++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/deploy.yaml b/.forgejo/workflows/deploy.yaml index a2f1716..9569735 100644 --- a/.forgejo/workflows/deploy.yaml +++ b/.forgejo/workflows/deploy.yaml @@ -79,8 +79,47 @@ jobs: run: | rsync -v -r --delete -e "ssh -i deploykey.priv -o 'UserKnownHostsFile ./known_hosts'" public/ ccchh-website-deploy@public-web-static-intern.hamburg.ccc.de:/var/www/hamburg.ccc.de/ - - uses: actions/upload-artifact@v3 - if: github.event_name == 'pull_request' + - name: Upload the website build as an artifact + uses: actions/upload-artifact@v4 with: name: website-build path: public/ + + deploy-prod: + runs-on: docker + container: + image: code.forgejo.org/oci/node:22-bookworm + steps: + - name: Download the website build artifact + uses: actions/download-artifact@v4 + with: + name: website-build + + - name: Install packages + run: | + apt update + # For uploading. + apt install -y rsync + + + - name: debugging + run: | + ls -la + echo "website-build:" + ls -la website-build + + deploy-staging: + runs-on: docker + container: + image: code.forgejo.org/oci/node:22-bookworm + steps: + - name: Download the website build artifact + uses: actions/download-artifact@v4 + with: + name: website-build + + - name: Install packages + run: | + apt update + # For uploading. + apt install -y rsync