mirror of
https://github.com/graycoreio/github-actions-magento2.git
synced 2026-06-08 19:46:41 +00:00
71 lines
2.1 KiB
YAML
71 lines
2.1 KiB
YAML
name: Get Magento Version
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- ".github/workflows/_internal-get-magento-version.yaml"
|
|
- "get-magento-version/**"
|
|
- "!**/*.md"
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- ".github/workflows/_internal-get-magento-version.yaml"
|
|
- "get-magento-version/**"
|
|
- "!**/*.md"
|
|
|
|
jobs:
|
|
get-magento-version:
|
|
if: "!startsWith(github.head_ref, 'release-please')"
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- name: Set PHP Version
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: 8.1
|
|
tools: composer:v2.4.2
|
|
|
|
- run: composer create-project --repository-url="https://mirror.mage-os.org" "magento/project-community-edition:2.4.5-p1" ../magento2 --no-install
|
|
shell: bash
|
|
name: Create Magento ${{ matrix.magento }} Project
|
|
|
|
- uses: ./get-magento-version
|
|
id: magento-version
|
|
with:
|
|
working-directory: ../magento2
|
|
|
|
- name: Fail if version does not match
|
|
if: steps.magento-version.outputs.version != '"2.4.5-p1"'
|
|
shell: bash
|
|
run: echo "${{ steps.magento-version.outputs.version }}" && exit 1
|
|
|
|
- name: Fail if project does not match
|
|
if: steps.magento-version.outputs.project != 'magento/project-community-edition'
|
|
shell: bash
|
|
run: echo "${{ steps.magento-version.outputs.project }}" && exit 1
|
|
|
|
get-magento-version-extension:
|
|
if: "!startsWith(github.head_ref, 'release-please')"
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Create mock extension composer.json
|
|
shell: bash
|
|
run: |
|
|
mkdir -p /tmp/test-extension
|
|
echo '{"name":"vendor/module","type":"magento2-module","require":{}}' > /tmp/test-extension/composer.json
|
|
|
|
- uses: ./get-magento-version
|
|
id: ext-version
|
|
with:
|
|
working-directory: /tmp/test-extension
|
|
|
|
- name: Fail if project is not empty
|
|
if: steps.ext-version.outputs.project != ''
|
|
shell: bash
|
|
run: echo "Expected empty project, got '${{ steps.ext-version.outputs.project }}'" && exit 1
|