Skip to content

Commit 5bc7e04

Browse files
committed
Adjust provided example from documentation
add a section `Advanced Usages` and provide an example to append a tring to advertised versions.
1 parent 8c496e3 commit 5bc7e04

File tree

1 file changed

+29
-28
lines changed

1 file changed

+29
-28
lines changed

README.md

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ jobs:
3737
uses: perl-actions/perl-versions@v1
3838
with:
3939
since-perl: v5.20
40+
with-devel: false
4041

4142
##
42-
## Using perl-versions with perl-tester
43+
## Combining perl-versions with perl-tester
4344
##
4445
test:
4546
needs:
@@ -54,38 +55,38 @@ jobs:
5455
steps:
5556
- uses: actions/checkout@v4
5657
- run: perl -V
58+
# adjust that section to fit your distribution
59+
# cpanm is available at that stage
60+
- run: cpanm install .
61+
- run: perl Makefile.PL
62+
- run: make
63+
- run: make test
5764

5865
```
5966

60-
# Reusable workflow
67+
## Advanced Usages
6168

62-
There is also reusable workflow simplifying call of this action.
69+
### Altering the values
6370

64-
## Inputs
65-
66-
### since-perl
67-
68-
Forwarded to action.
69-
70-
## Outputs
71-
72-
### perl-version
73-
74-
String containing JSON array with list of Perl versions.
75-
76-
## Usage
71+
Here is an example to massage the Perl versions to append the string `-buster` to all `5.\d+` versions. (TIMTODY)
7772

7873
```yaml
79-
jobs:
8074
perl-versions:
81-
uses: perl-actions/perl-versions@v1
82-
with:
83-
since-perl: "5.14"
84-
85-
test:
86-
needs:
87-
- perl-versions
88-
strategy:
89-
matrix:
90-
perl-versions: ${{ fromJson (needs.perl-versions.outputs.perl-versions) }}
91-
```
75+
runs-on: ubuntu-latest
76+
name: List Perl versions
77+
outputs:
78+
perl-versions: ${{ steps.massage.outputs.perl-versions }}
79+
steps:
80+
- id: action
81+
uses: perl-actions/perl-versions@v1
82+
with:
83+
since-perl: v5.10
84+
with-devel: true
85+
- id: massage
86+
name: add buster
87+
run: |
88+
echo '${{ steps.action.outputs.perl-versions }}' > perl.versions
89+
perl -pi -e 's/"(\d\.\d+)"/"$1-buster"/g' perl.versions
90+
cat perl.versions
91+
echo "perl-versions=$(cat perl.versions)" >> $GITHUB_OUTPUT
92+
```

0 commit comments

Comments
 (0)