-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yaml
35 lines (35 loc) · 1.34 KB
/
action.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
name: "Pubspec Metadata"
description: "Retrieve metadata from pubspec.yaml for Flutter/Dart."
author: altive
branding:
icon: "file-text"
color: "blue"
inputs:
pubspec-file:
description: "Path to your pubspec.yaml file. Default is './pubspec.yaml'"
required: false
default: "./pubspec.yaml"
outputs:
name:
description: "The name of the package."
value: ${{ steps.retriever.outputs.name }}
version-number:
description: "The version number of the package, which is three numbers separated by a dot, such as 0.2.43."
value: ${{ steps.retriever.outputs.version-number }}
build-number:
description: "The build number of the package. The number following the + after the version number."
value: ${{ steps.retriever.outputs.build-number }}
runs:
using: "composite"
steps:
- id: retriever
run: |
NAME=`cat ${{ inputs.pubspec-file }} | grep -E '^name:' | awk -F'[:]' '{print $2}'| xargs`
VERSION=`cat ${{ inputs.pubspec-file }} | grep -E '^version:\s*([^\+]+)' | awk -F'[:+]' '{print $2}'| xargs`
BUILD=`cat ${{ inputs.pubspec-file }} | grep -E '^version:\s*([^\+]+)' | awk -F'[:+]' '{print $3}'| xargs`
{
echo "name=$(echo "$NAME")"
echo "version-number=$(echo "$VERSION")"
echo "build-number=$(echo "$BUILD")"
} >> "$GITHUB_OUTPUT"
shell: bash