mirror of
https://github.com/graycoreio/github-actions-magento2.git
synced 2026-06-08 19:46:41 +00:00
feat(get-magento-version): add get-magento-version action (#72)
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
# "Get Magento Version" Action
|
||||
|
||||
A Github Action that computes an installed Magento version.
|
||||
|
||||
## Inputs
|
||||
|
||||
See the [action.yml](./action.yml)
|
||||
|
||||
## Usage
|
||||
|
||||
```yml
|
||||
name: Get Magento Version
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
version:
|
||||
runs-on: ubuntu-latest
|
||||
name: A job to compute an installed Magento version.
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: graycoreio/github-actions-magento2/get-magento-version@main
|
||||
id: get-magento-version
|
||||
- run: echo version ${{ steps.get-magento-version.outputs.version }}
|
||||
shell: bash
|
||||
```
|
||||
@@ -0,0 +1,31 @@
|
||||
name: "Get Magento Version"
|
||||
author: "Graycore"
|
||||
description: " A Github Action that determines the currently installed version of Magento"
|
||||
|
||||
inputs:
|
||||
working-directory:
|
||||
default: $GITHUB_WORKSPACE
|
||||
description: "The current working directory of the action"
|
||||
required: false
|
||||
|
||||
outputs:
|
||||
version: # id of output
|
||||
description: 'The determined version of Magento'
|
||||
value: ${{ steps.get-magento-version.outputs.version }}
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- run: |
|
||||
echo "::set-output name=version::$(cat composer.json | jq '.require
|
||||
| with_entries( select(.key == "magento/product-community-edition" or .key == "magento/product-enterprise-edition") )
|
||||
| to_entries
|
||||
| .[0].value')"
|
||||
shell: bash
|
||||
working-directory: ${{ inputs.working-directory }}
|
||||
name: Compute Installed Magento version
|
||||
id: get-magento-version
|
||||
|
||||
branding:
|
||||
icon: "code"
|
||||
color: "green"
|
||||
Reference in New Issue
Block a user