Shopware Instance #3
This file contains 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: 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 | |
baseRepo: | |
description: 'baseRepo' | |
required: true | |
prNumber: | |
description: 'PR number' | |
required: true | |
permissions: | |
id-token: write | |
jobs: | |
create-instance: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Fetch scoped token | |
id: fetch-token | |
uses: FriendsOfShopware/automation-bot/actions/fetch-token@main | |
with: | |
id: "${{ inputs.id }}" | |
- uses: namespacelabs/nscloud-setup@v0 | |
- name: Create a Namespace cluster | |
id: create-cluster | |
uses: namespacelabs/nscloud-cluster-action@v0 | |
with: | |
preview: true | |
- name: Deploy NGINX | |
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: | | |
until kubectl get pods shopware -o jsonpath='{.items[*].status.conditions[?(@.type=="Ready")].status}' | grep -q "True"; do | |
echo "Waiting for Shopware pod to be ready..." | |
kubectl get pods shopware | |
sleep 10 | |
done | |
- name: Fix APP_URL | |
run: | | |
kubectl exec pod/shopware -- mariadb -e 'UPDATE sales_channel_domain SET url = "${{ steps.expose.preview-url }}"' | |
kubectl exec pod/shopware -- bin/console cache:clear:all |