diff --git a/project-deployer/README.md b/project-deployer/README.md new file mode 100644 index 0000000..83ec335 --- /dev/null +++ b/project-deployer/README.md @@ -0,0 +1,66 @@ +# Project Deployer + +This GitHub Action builds and deploys a Shopware project using shopware-cli and deployer. + +## What it does + +1. Checks out your repository (optional) +2. Sets up PHP with the specified version +3. Installs Shopware CLI +4. Builds the project using `shopware-cli project ci` +5. Deploys using deployphp/action + +## Inputs + +| Input | Description | Required | Default | +|-------|-------------|----------|---------| +| `phpVersion` | PHP version to use | No | `8.4` | +| `sshPrivateKey` | SSH private key for deployment (use `secrets.SSH_PRIVATE_KEY`) | Yes | - | +| `deployCommand` | Deploy command to run | No | `deploy` | +| `path` | Path to the project | No | `.` | +| `skipCheckout` | Skip the checkout step | No | `false` | + +## Usage + +### Basic usage + +```yaml +name: Deploy + +on: + workflow_dispatch: + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: shopware/github-actions/project-deployer@main + with: + sshPrivateKey: ${{ secrets.SSH_PRIVATE_KEY }} +``` + +### With custom PHP version and path + +```yaml +- uses: shopware/github-actions/project-deployer@main + with: + phpVersion: '8.3' + path: './shopware' + sshPrivateKey: ${{ secrets.SSH_PRIVATE_KEY }} + deployCommand: 'deploy production' +``` + +### Skip checkout (if already checked out) + +```yaml +- uses: actions/checkout@v6 +- uses: shopware/github-actions/project-deployer@main + with: + skipCheckout: 'true' + sshPrivateKey: ${{ secrets.SSH_PRIVATE_KEY }} +``` + +## Requirements + +- SSH private key must be stored as a repository secret named `SSH_PRIVATE_KEY` +- Your project must have a deployer configuration file (deploy.php) diff --git a/project-deployer/action.yml b/project-deployer/action.yml new file mode 100644 index 0000000..8d510a1 --- /dev/null +++ b/project-deployer/action.yml @@ -0,0 +1,52 @@ +name: "Project Deployer" +description: "Builds and deploys a Shopware project using shopware-cli and deployer" +author: "shopware AG" +branding: + color: "blue" + icon: "upload" + +inputs: + phpVersion: + description: "PHP version to use" + required: false + default: "8.4" + sshPrivateKey: + description: "SSH private key for deployment (use secrets.SSH_PRIVATE_KEY)" + required: true + deployCommand: + description: "Deploy command to run" + required: false + default: "deploy" + path: + description: "Path to the project" + required: false + default: "." + skipCheckout: + description: "Skip the checkout step" + required: false + default: "false" + +runs: + using: "composite" + steps: + - name: Checkout + if: inputs.skipCheckout != 'true' + uses: actions/checkout@v6 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ inputs.phpVersion }} + + - name: Install Shopware CLI + uses: shopware/shopware-cli-action@v3 + + - name: Build + shell: bash + run: shopware-cli project ci ${{ inputs.path }} + + - name: Deploy + uses: deployphp/action@v1 + with: + dep: ${{ inputs.deployCommand }} + private-key: ${{ inputs.sshPrivateKey }} diff --git a/project-validate/README.md b/project-validate/README.md new file mode 100644 index 0000000..fa5d380 --- /dev/null +++ b/project-validate/README.md @@ -0,0 +1,70 @@ +# Project Validate + +This GitHub Action validates a Shopware project code style and structure. + +## What it does + +1. Checks out your repository (optional) +2. Sets up PHP with the specified version +3. Installs Shopware CLI +4. Installs composer dependencies +5. Validates the project structure using `shopware-cli project validate` +6. Checks code style using `shopware-cli project format --dry-run` + +## Inputs + +| Input | Description | Required | Default | +|-------|-------------|----------|---------| +| `phpVersion` | PHP version to use | No | `8.4` | +| `path` | Path to the project | No | `.` | +| `skipCheckout` | Skip the checkout step | No | `false` | + +## Usage + +### Basic usage + +```yaml +name: Check + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: shopware/github-actions/project-validate@main +``` + +### With custom PHP version + +```yaml +- uses: shopware/github-actions/project-validate@main + with: + phpVersion: '8.3' +``` + +### With custom path + +```yaml +- uses: shopware/github-actions/project-validate@main + with: + path: './shopware' +``` + +### Skip checkout (if already checked out) + +```yaml +- uses: actions/checkout@v6 +- uses: shopware/github-actions/project-validate@main + with: + skipCheckout: 'true' +``` + +## Requirements + +- Your project must have a `composer.json` file +- The project should follow Shopware project structure diff --git a/project-validate/action.yml b/project-validate/action.yml new file mode 100644 index 0000000..a262c01 --- /dev/null +++ b/project-validate/action.yml @@ -0,0 +1,46 @@ +name: "Project Validate" +description: "Validates a Shopware project code style and structure" +author: "shopware AG" +branding: + color: "blue" + icon: "check-circle" + +inputs: + phpVersion: + description: "PHP version to use" + required: false + default: "8.4" + path: + description: "Path to the project" + required: false + default: "." + skipCheckout: + description: "Skip the checkout step" + required: false + default: "false" + +runs: + using: "composite" + steps: + - name: Checkout + if: inputs.skipCheckout != 'true' + uses: actions/checkout@v6 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ inputs.phpVersion }} + + - name: Install Shopware CLI + uses: shopware/shopware-cli-action@v3 + + - name: Install dependencies + uses: ramsey/composer-install@v3 + + - name: Validate Project + shell: bash + run: shopware-cli project validate ${{ inputs.path }} + + - name: Check Code Style + shell: bash + run: shopware-cli project format --dry-run ${{ inputs.path }}