Skip to content

Commit bc840e1

Browse files
feat(get-composer-version): create new action (#145)
This creates a new A Github Action that determines the currently installed version of Composer. Co-authored-by: Vitaliy Golomoziy <[email protected]>
1 parent f79de7d commit bc840e1

File tree

3 files changed

+91
-0
lines changed

3 files changed

+91
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Get Composer Version
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- testing
8+
paths:
9+
- ".github/workflows/_internal-get-composer-version.yaml"
10+
- "get-composer-version/**"
11+
- "!(**/*.md)"
12+
pull_request:
13+
branches:
14+
- main
15+
paths:
16+
- ".github/workflows/_internal-get-composer-version.yaml"
17+
- "get-composer-version/**"
18+
- "!(**/*.md)"
19+
20+
jobs:
21+
get-composer-version:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v3
25+
- name: Set PHP Version
26+
uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: 8.1
29+
tools: composer:v2.4.2
30+
31+
- uses: ./get-composer-version
32+
id: composer-version
33+
34+
35+
- name: Fail if versions do not match
36+
if: steps.composer-version.outputs.version != '2.4.2'
37+
shell: bash
38+
run: echo "${{ steps.composer-version.outputs.version }}" && exit 1
39+

get-composer-version/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# "Get Composer Version" Action
2+
3+
A Github Action that computes an installed Composer version.
4+
5+
## Inputs
6+
7+
See the [action.yml](./action.yml)
8+
9+
## Usage
10+
11+
```yml
12+
name: Get Composer Version
13+
14+
on:
15+
push:
16+
branches:
17+
- main
18+
pull_request:
19+
branches:
20+
- main
21+
22+
jobs:
23+
version:
24+
runs-on: ubuntu-latest
25+
name: A job to compute an installed Composer version.
26+
steps:
27+
- uses: actions/checkout@v3
28+
- uses: mage-os/github-actions/get-composer-version@main
29+
id: get-composer-version
30+
- run: echo version ${{ steps.get-composer-version.outputs.version }}
31+
shell: bash
32+
```

get-composer-version/action.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: "Get Composer Version"
2+
author: "Graycore"
3+
description: " A Github Action that determines the currently installed version of Composer"
4+
5+
outputs:
6+
version: # id of output
7+
description: 'The determined version of Composer'
8+
value: ${{ steps.get-composer-version.outputs.version }}
9+
10+
runs:
11+
using: "composite"
12+
steps:
13+
- run: echo "version=$(composer --version | awk '{print $3}')" >> $GITHUB_OUTPUT
14+
shell: bash
15+
name: Compute Installed Composer version
16+
id: get-composer-version
17+
18+
branding:
19+
icon: "code"
20+
color: "green"

0 commit comments

Comments
 (0)