-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.yml
49 lines (45 loc) · 1.72 KB
/
action.yml
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: MunkiPkg Action
author: joncrain
description: GitHub Action to build a macOS package for release.
branding:
icon: command
color: gray-dark
inputs:
munkipkg_version:
default: https://raw.githubusercontent.com/munki/munki-pkg/8d68abbab4c459857d28fdd84ad668ec6ccdf98a/munkipkg
required: false
pkg_subdir:
default: ""
required: false
outputs:
tag:
value: ${{ steps.munkipkg.outputs.tag }}
description: "Returns the pkg version from the build-info file."
filename:
value: ${{ steps.munkipkg.outputs.filename }}
description: "Returns the filename of the built pkg."
filepath:
value: ${{ steps.munkipkg.outputs.filepath }}
description: "Returns the filepath of the built pkg."
runs:
using: "composite"
steps:
- id: munkipkg
run: |
curl ${{ inputs.munkipkg_version }} -o ${{ github.action_path }}/munkipkg
chmod +x ${{ github.action_path }}/munkipkg
pkg_path="$GITHUB_WORKSPACE"/${{ inputs.pkg_subdir }}
python3 ${{ github.action_path }}/munkipkg "$pkg_path"
if [ -f "$pkg_path"/build-info.json ]; then
version=$(jq -r .version "$pkg_path"/build-info.json)
elif [ -f "$pkg_path"/build-info.plist ]; then
version=$(defaults read "$pkg_path"/build-info.plist version)
elif [ -f "$pkg_path"/build-info.yaml ]; then
version=$(grep -A3 'version:' "$pkg_path"/build-info.yaml | tail -n1 | awk '{ print $2}' | sed "s/\'//g")
fi
echo "tag=$(echo v${version})" >> $GITHUB_OUTPUT
for file in "$pkg_path"/build/*; do
echo "filename=$(echo "${file##*/}")" >> $GITHUB_OUTPUT
echo "filepath=$(echo "$pkg_path/build/${file##*/}")" >> $GITHUB_OUTPUT
done
shell: bash