Skip to content

Merge pull request #20 from plone/datakurre-navigation #109

Merge pull request #20 from plone/datakurre-navigation

Merge pull request #20 from plone/datakurre-navigation #109

Workflow file for this run

name: Main branch deploy testing
on:
push:
paths:
- "backend/**"
- "frontend/**"
- ".github/workflows/backend.yml"
- ".github/workflows/frontend.yml"
- ".github/workflows/main.yml"
- "devops/**"
branches:
- '**'
workflow_dispatch:
env:
IMAGE_NAME_PREFIX: ghcr.io/plone/2025.ploneconf.org
NODE_VERSION: "22.x"
PYTHON_VERSION: "3.12"
STACK_PARAM: latest
STACK_NAME: testing-ploneconf-org
STACK_PREFIX: testing_ploneconf
PUBLIC_URL: testing.ploneconf.org
CERTRESOLVER: le-cloudflare
STACK_FILE: devops/stacks/testing.ploneconf.org.yml
jobs:
config:
runs-on: ubuntu-latest
outputs:
backend: ${{ steps.filter.outputs.backend }}
frontend: ${{ steps.filter.outputs.frontend }}
BASE_TAG: ${{ steps.vars.outputs.BASE_TAG }}
IMAGE_NAME_PREFIX: ${{ env.IMAGE_NAME_PREFIX }}
NODE_VERSION: ${{ env.NODE_VERSION }}
PYTHON_VERSION: ${{ env.PYTHON_VERSION }}
PLONE_VERSION: ${{ steps.vars.outputs.PLONE_VERSION }}
VOLTO_VERSION: ${{ steps.vars.outputs.VOLTO_VERSION }}
DEPLOY_ENVIRONMENT: ${{ steps.vars.outputs.DEPLOY_ENVIRONMENT }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Compute several vars needed for the CI
id: vars
run: |
echo "BASE_TAG=sha-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "PLONE_VERSION=$(cat backend/version.txt)" >> $GITHUB_OUTPUT
python3 -c 'import json; data = json.load(open("./frontend/mrs.developer.json")); print("VOLTO_VERSION=" + (data["core"].get("tag") or "latest"))' >> $GITHUB_OUTPUT
echo "DEPLOY_ENVIRONMENT=${{ env.PUBLIC_URL }}" >> $GITHUB_OUTPUT
- name: Test vars
run: |
echo 'BASE_TAG=${{ steps.vars.outputs.BASE_TAG }}'
echo 'PLONE_VERSION=${{ steps.vars.outputs.PLONE_VERSION }}'
echo 'VOLTO_VERSION=${{ steps.vars.outputs.VOLTO_VERSION }}'
echo "DEPLOY_ENVIRONMENT=${{ env.PUBLIC_URL }}" >> $GITHUB_OUTPUT
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
backend:
- 'backend/**'
- '.github/workflows/backend.yml'
frontend:
- 'frontend/**'
- '.github/workflows/frontend.yml'
backend:
uses: ./.github/workflows/backend.yml
needs:
- config
with:
base-tag: ${{ needs.config.outputs.BASE_TAG }}
image-name-prefix: ${{ needs.config.outputs.IMAGE_NAME_PREFIX }}
image-name-suffix: backend
python-version: ${{ needs.config.outputs.PYTHON_VERSION }}
plone-version: ${{ needs.config.outputs.PLONE_VERSION }}
if: ${{ needs.config.outputs.backend == 'true' }}
permissions:
contents: read
packages: write
frontend:
uses: ./.github/workflows/frontend.yml
needs:
- config
with:
base-tag: ${{ needs.config.outputs.BASE_TAG }}
image-name-prefix: ${{ needs.config.outputs.IMAGE_NAME_PREFIX }}
image-name-suffix: frontend
node-version: ${{ needs.config.outputs.NODE_VERSION }}
volto-version: ${{ needs.config.outputs.VOLTO_VERSION }}
if: ${{ needs.config.outputs.frontend == 'true' }}
permissions:
contents: read
packages: write
deploy:
concurrency: deploy_testing
needs: [config, backend, frontend]
if: ${{ always() && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && !contains(needs.*.result, 'failure') }}
timeout-minutes: 8
runs-on: ubuntu-latest
environment:
name: ${{ needs.config.outputs.DEPLOY_ENVIRONMENT }}
url: https://${{ needs.config.outputs.DEPLOY_ENVIRONMENT }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Deploy
uses: kitconcept/[email protected]
with:
registry: 'ghcr.io'
username: ${{ github.actor }}
password: ${{ secrets.DEPLOY_GHCR_READ_TOKEN }}
remote_host: ${{ vars.DEPLOY_HOST }}
remote_port: ${{ vars.DEPLOY_PORT }}
remote_user: ${{ vars.DEPLOY_USER }}
remote_private_key: ${{ secrets.DEPLOY_SSH }}
stack_file: ${{ env.STACK_FILE }}
stack_name: ${{ env.STACK_NAME }}
# stack_param: container version/tag. because we don't specify it here 'latest' is used in the stack file.
# 'latest' is needed because one of the backend/frontend iamges was maybe not built on this base_tag
# Then we re-use the existing latest ;-)
env_file: |
STACK_NAME=${{ env.STACK_NAME }}
STACK_PREFIX=${{ env.STACK_PREFIX }}
PUBLIC_URL=${{ env.PUBLIC_URL }}
CERTRESOLVER=${{ env.CERTRESOLVER }}
BACKEND_IMAGE=${{ env.IMAGE_NAME_PREFIX }}-backend
FRONTEND_IMAGE=${{ env.IMAGE_NAME_PREFIX }}-frontend
DB_HOST=${{ vars.DB_HOST }}
DB_PORT=${{ vars.DB_PORT }}
DB_NAME=${{ vars.DB_NAME }}
DB_USER=${{ vars.DB_USER }}
DB_PASSWORD=${{ secrets.DB_PASSWORD }}
BASIC_AUTH_USER=${{ vars.BASIC_AUTH_USER }}
BASIC_AUTH_PASSWORD_FRONTEND=${{ vars.BASIC_AUTH_PASSWORD_FRONTEND }}
BASIC_AUTH_PASSWORD_CLASSICUI=${{ vars.BASIC_AUTH_PASSWORD_CLASSICUI }}
deploy_timeout: 480
report:
name: "Final report"
if: ${{ always() }}
runs-on: ubuntu-latest
needs:
- config
- backend
- frontend
- deploy
steps:
- name: Write report
run: |
echo '# Workflow Report' >> $GITHUB_STEP_SUMMARY
echo '| Job ID | Conclusion |' >> $GITHUB_STEP_SUMMARY
echo '| --- | --- |' >> $GITHUB_STEP_SUMMARY
echo '| config | ${{ needs.config.result }} |' >> $GITHUB_STEP_SUMMARY
echo '| backend | ${{ needs.backend.result }} |' >> $GITHUB_STEP_SUMMARY
echo '| frontend | ${{ needs.frontend.result }} |' >> $GITHUB_STEP_SUMMARY