Skip to content

Shopware Instance

Shopware Instance #9

Workflow file for this run

name: Shopware Instance
on:
workflow_dispatch:
inputs:
id:
description: "Execution ID"
required: true
owner:
description: 'Owner of the repo'
required: true
repo:
description: 'Repo to run against'
required: true
branch:
description: 'Branch to run against'
required: true
default: main
php-version:
description: 'PHP version to use'
required: true
default: "8.2"
baseRepo:
description: 'baseRepo'
required: true
prNumber:
description: 'PR number'
required: true
permissions:
id-token: write
jobs:
create-instance:
runs-on: ubuntu-latest
steps:
- name: Install Shopware CLI
uses: FriendsOfShopware/shopware-cli-action@v1
- name: Fetch scoped token
id: fetch-token
uses: FriendsOfShopware/automation-bot/actions/fetch-token@main
with:
id: "${{ inputs.id }}"
- name: Clone Plugin
uses: actions/checkout@v4
with:
path: plugin
repository: "${{ inputs.owner }}/${{ inputs.repo }}"
ref: "${{ inputs.branch }}"
token: ${{ steps.fetch-token.outputs.token }}
- name: Build Plugin
run: shopware-cli extension build plugin
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ inputs.php-version }}"
- name: Setup Namespace CLI
uses: namespacelabs/nscloud-setup@v0
- name: Create a Namespace cluster
id: create-cluster
uses: namespacelabs/nscloud-cluster-action@v0
with:
preview: true
- name: Deploy Shopware
run: |
kubectl run shopware --image=ghcr.io/shopwarelabs/devcontainer/symfony-flex:6.6.8-8.3
kubectl expose pod shopware --type=LoadBalancer --port=8000
- name: Expose application
id: expose
uses: namespacelabs/nscloud-expose-kubernetes-action@v0
with:
instance-id: ${{ steps.create-cluster.outputs.instance-id }}
namespace: default
service: shopware
- name: Wait for Container Startup
run: |
set +e
while true; do
kubectl exec pod/shopware -- bin/console plugin:list
if [ $? -eq 0 ]; then
echo "Command succeeded!"
break
fi
echo "Command failed, retrying in 1 seconds..."
sleep 1
done
- name: Fix APP_URL
run: |
kubectl exec pod/shopware -- mariadb shopware -e 'UPDATE sales_channel_domain SET url = "${{ steps.expose.outputs.preview-url }}"'
kubectl exec pod/shopware -- bin/console cache:clear:all
- name: Copy plugin into Container
run: |
kubectl cp plugin shopware:/var/www/html/custom/plugins/plugin
kubectl exec pod/shopware -- bin/console plugin:refresh
kubectl exec pod/shopware -- bin/console plugin:install --activate ${{ inputs.repo }}
- name: Create comment
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ inputs.prNumber }}
repository: ${{ inputs.baseRepo }}
body: |
Hey :wave:,
I have created for you an Shopware Instalation with the current changes made here.
You can access the Shop here: ${{ steps.expose.outputs.preview-url }}
The URL is only for FriendsOfShopware members.