Fix deploy #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Seven build and deploy demo | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "frontend-seven/**" | |
| - ".github/workflows/frontend.yml" | |
| - ".github/workflows/seven.yml" | |
| - "devops/stacks/seven.plone.org.yml" | |
| workflow_dispatch: | |
| env: | |
| IMAGE_NAME_PREFIX: ghcr.io/plone/demo-seven | |
| NODE_VERSION: "22.x" | |
| PYTHON_VERSION: "3.12" | |
| 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 }} | |
| 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 | |
| # - uses: dorny/paths-filter@v3 | |
| # id: filter | |
| # with: | |
| # base: scaffold_update | |
| # filters: | | |
| # backend: | |
| # - 'backend-volto/**' | |
| # - '.github/workflows/backend.yml' | |
| # frontend: | |
| # - 'frontend-seven/**' | |
| # - '.github/workflows/frontend.yml' | |
| - 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 'backend: ${{ steps.filter.outputs.backend }}' | |
| echo 'frontend: ${{ steps.filter.outputs.frontend }}' | |
| # 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 }} | |
| build-dir: frontend-seven/ | |
| docker-file: Dockerfile | |
| # if: ${{ needs.config.outputs.frontend == 'true' }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| deploy: | |
| runs-on: ubuntu-latest | |
| # this is overcomplicated for now, but allows us to re'add a custom backend again later | |
| #if: ${{ always() && github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && !contains(needs.*.result, 'failure') }} | |
| if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' | |
| needs: [config, frontend] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Deploy to cluster | |
| 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: devops/stacks/seven.plone.org.yml | |
| stack_name: seven-plone-org.yml | |
| stack_param: latest | |
| # env_file: | | |
| # DB_PASSWORD="not used" | |
| deploy_timeout: 480 | |
| report: | |
| name: "Final report" | |
| if: ${{ always() }} | |
| runs-on: ubuntu-latest | |
| needs: | |
| - config | |
| - 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 |