diff --git a/.gitea/workflows/code-analysis.yml b/.gitea/workflows/code-analysis.yml index 5cba5f7..063c489 100644 --- a/.gitea/workflows/code-analysis.yml +++ b/.gitea/workflows/code-analysis.yml @@ -3,7 +3,7 @@ name: Code Analysis and Production Deploy on: pull_request: push: - branches: [ main ] + branches: [ main, dev ] jobs: analyze: @@ -31,6 +31,10 @@ jobs: node -v npm -v + - name: Require package version change for main PRs + if: github.event_name == 'pull_request' && github.base_ref == 'main' + run: scripts/check-package-version-changed.sh origin/main + - name: gitleaks (Secrets Scanning) run: | # Try to get the latest release asset URL @@ -118,4 +122,35 @@ jobs: -o BatchMode=yes \ -p "${{ vars.PROD_PORT }}" \ "${{ vars.PROD_USER }}@${{ vars.PROD_HOST }}" \ - "bash -lc 'cd /var/www/harheimertc && ./deploy-production.sh'" + "bash -lc 'cd /var/www/harheimertc && git fetch origin main && git checkout -B main origin/main && git reset --hard origin/main && ./deploy-production.sh'" + + deploy-test: + runs-on: ubuntu-latest + needs: analyze + if: github.event_name == 'push' && github.ref == 'refs/heads/dev' + steps: + - name: Prepare SSH + run: | + set -euo pipefail + + mkdir -p ~/.ssh + printf "%s" "${{ secrets.PROD_SSH_KEY }}" > ~/.ssh/id_ed25519 + chmod 600 ~/.ssh/id_ed25519 + ssh-keyscan -p "${{ vars.PROD_PORT }}" "${{ vars.PROD_HOST }}" >> ~/.ssh/known_hosts + + - name: Test SSH connection + run: | + ssh -i ~/.ssh/id_ed25519 \ + -o StrictHostKeyChecking=no \ + -o BatchMode=yes \ + -p "${{ vars.PROD_PORT }}" \ + "${{ vars.PROD_USER }}@${{ vars.PROD_HOST }}" \ + "echo SSH OK" + + - name: Run test deployment script + run: | + ssh -i ~/.ssh/id_ed25519 \ + -o BatchMode=yes \ + -p "${{ vars.PROD_PORT }}" \ + "${{ vars.PROD_USER }}@${{ vars.PROD_HOST }}" \ + "bash -lc 'cd /var/www/harheimertc.test && git fetch origin dev && git checkout -B dev origin/dev && git reset --hard origin/dev && ./deploy-test.sh'" diff --git a/components/Footer.vue b/components/Footer.vue index fa1e731..af6fb86 100644 --- a/components/Footer.vue +++ b/components/Footer.vue @@ -6,6 +6,13 @@ © {{ currentYear }} Harheimer TC 1954 e.V.