Skip to content

Commit a68ad5f

Browse files
authored
Github workflow for pkgbuild
1 parent d2d5d1d commit a68ad5f

4 files changed

Lines changed: 67 additions & 4 deletions

File tree

.github/workflows/pkgbuild.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Build release package
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
runs-on: macos-latest
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v1
14+
- name: Build package
15+
id: build_package
16+
run: ./build.sh
17+
- name: Create release
18+
id: create_release
19+
uses: actions/create-release@v1
20+
env:
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
with:
23+
tag_name: v${{ steps.build_package.outputs.version}}
24+
release_name: Release ${{ steps.build_package.outputs.version}}
25+
body: See <a href="../../blob/main/CHANGELOG.md">CHANGELOG.md</a>
26+
draft: true
27+
prerelease: false
28+
- name: Upload release asset
29+
id: upload-release-asset
30+
uses: actions/upload-release-asset@v1
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
with:
34+
upload_url: ${{ steps.create_release.outputs.upload_url }}
35+
asset_path: ./build/simplemdm-munki-plugin-${{ steps.build_package.outputs.version}}.pkg
36+
asset_name: simplemdm-munki-plugin-${{ steps.build_package.outputs.version}}.pkg
37+
asset_content_type: application/octet-stream

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build/
2+
source/

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
## Requirements
44

5-
If you plan on using [AutoPkg](https://github.com/autopkg/autopkg), release 2.2 or greater is required as earlier versions do not have Munki repo plugin support.
5+
If you plan on using [AutoPkg](https://github.com/autopkg/autopkg), release 2.2 or greater is required as earlier versions do not have Munki repo plugin support. Please note that release 2.2 includes a bug that prevents _updates_ from uploading. Please use AutoPkg 2.3, or as this version has not yet been released as of today (9/9/2020), build and install AutoPkg from the source available in the master branch.
66

77
## Installation
88

9-
1. Place `SimpleMDMRepo.py` in the `/usr/local/munki/munkilib/munkirepo/` folder.
10-
1. (Optionally) move `config.plist` to `/usr/local/simplemdm/munki-plugin/config.plist`.
9+
Download and install the [latest release](https://github.com/SimpleMDM/munki-plugin/releases/latest).
1110

1211
## API Key
1312

@@ -39,7 +38,7 @@ SIMPLEMDM_API_KEY="Whvop7kWXxsva326ABDF8VDCSGFyEkuEx2xGgj4jab8AE90cn70QdBTq0fpll
3938

4039
#### Configuration File
4140

42-
You may store the key in a configuration file at `/usr/local/simplemdm/munki-plugin/config.plist`. Please scope the permissions on this file so that it is restricted, however still allowing utilities using the repo plugin to access it.
41+
You may store the key in the configuration file at `/usr/local/simplemdm/munki-plugin/config.plist`. Please scope the permissions on this file so that it is restricted, however still allowing utilities using the repo plugin to access it.
4342

4443
The file should be formatted as below. Be sure to provide your own API key:
4544

build.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
set -eu
2+
3+
version="$(grep '# Version' SimpleMDMRepo.py|awk -F'Version ' '{print $2}')"
4+
5+
echo "::set-output name=version::${version}"
6+
7+
project_root="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8+
build_dir="$project_root/build"
9+
src_dir="$project_root/src"
10+
pkg_path="${build_dir}/simplemdm-munki-plugin-${version}.pkg"
11+
12+
rm -rf "$src_dir"
13+
mkdir "$src_dir"
14+
15+
mkdir -p "$src_dir/usr/local/munki/munkilib/munkirepo"
16+
cp "$project_root/SimpleMDMRepo.py" "$src_dir/usr/local/munki/munkilib/munkirepo/SimpleMDMRepo.py"
17+
mkdir -p "$src_dir/usr/local/simplemdm/munki-plugin"
18+
cp -n "$project_root/config.plist" "$src_dir/usr/local/simplemdm/munki-plugin/config.plist"
19+
20+
rm -rf "$build_dir"
21+
mkdir "$build_dir"
22+
23+
pkgbuild --root "$src_dir" --identifier com.simplemdm.munki_plugin --version $version "$pkg_path"
24+
25+
rm -rf "$src_dir"

0 commit comments

Comments
 (0)