updates for reliability, efficiency

This commit is contained in:
Ray Lyon
2021-11-05 14:40:14 -04:00
committed by GitHub
parent 8a8edc894e
commit ca11e90e99

View File

@@ -23,35 +23,61 @@ on:
pull_request: pull_request:
branches: branches:
- main - main
paths:
- 'RecipeOverrides/**'
jobs: jobs:
AutoPkg: AutoPkg:
runs-on: macos-latest runs-on: macos-latest
timeout-minutes: 15 timeout-minutes: 25
steps: steps:
- name: Checkout it-autopkg - name: Checkout it-autopkg
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Get file changes
- name: Set env variables uses: dorny/paths-filter@v2
id: filter
with:
filters: |
recipes:
- 'RecipeOverrides/**.recipe'
templates:
- 'RecipeOverrides/**.xml'
- name: List new recipes in temp file
if: steps.filter.outputs.recipes == 'true'
run: | run: |
echo "NEW_RECIPES="$(git diff --name-only origin/main | grep ".*\.recipe$" | sort -u)"" >> $GITHUB_ENV git diff --name-status origin/main | grep ".*\.recipe$" | sed '/^D/d' | grep -v '^R100' | cut -c 3- | sort -u > /tmp/new_recipes.txt
- name: List new recipe templates in temp file
if: steps.filter.outputs.templates == 'true'
run: |
git diff --name-status origin/main | grep ".*\.xml" | sed '/^D/d' | grep -v '^R100' | cut -c 3- | sort -u > /tmp/new_templates.txt
- name: Validate XML syntax for recipes
if: steps.filter.outputs.recipes == 'true'
run: |
while read recipe; do xmllint --noout "$recipe"; done < <(cat /tmp/new_recipes.txt)
- name: Validate XML syntax for recipe templates
if: steps.filter.outputs.templates == 'true'
run: |
while read template; do xmllint --noout "$template"; done < <(cat /tmp/new_templates.txt)
- name: Install AutoPkg - name: Install AutoPkg
if: steps.filter.outputs.recipes == 'true'
run: | run: |
curl -L https://github.com/autopkg/autopkg/releases/download/v2.1/autopkg-2.1.pkg --output /tmp/autopkg.pkg curl -L https://github.com/autopkg/autopkg/releases/download/v2.3.1/autopkg-2.3.1.pkg --output /tmp/autopkg.pkg
sudo installer -pkg /tmp/autopkg.pkg -target / sudo installer -pkg /tmp/autopkg.pkg -target /
- name: Install JSSImporter - name: Install JSSImporter
if: steps.filter.outputs.recipes == 'true'
run: | run: |
curl -L https://github.com/jssimporter/JSSImporter/releases/download/v1.1.2/jssimporter-1.1.2.pkg --output /tmp/jssimporter.pkg curl -L https://github.com/jssimporter/JSSImporter/releases/download/v1.1.5/jssimporter-1.1.5.pkg --output /tmp/jssimporter.pkg
sudo installer -pkg /tmp/jssimporter.pkg -target / sudo installer -pkg /tmp/jssimporter.pkg -target /
- name: Configure AutoPkg - name: Configure AutoPkg
if: steps.filter.outputs.recipes == 'true'
env: env:
JSS_USERNAME: ${{ secrets.JSS_USERNAME }} JSS_USERNAME: ${{ secrets.JSS_USERNAME_SANDBOX }}
JSS_PASSWORD: ${{ secrets.JSS_PASSWORD }} JSS_PASSWORD: ${{ secrets.JSS_PASSWORD_SANDBOX }}
JSS_URL: ${{ secrets.JSS_URL }} JSS_URL: ${{ secrets.JSS_URL }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: | run: |
defaults write com.github.autopkg RECIPE_OVERRIDE_DIRS $(pwd)/RecipeOverrides/ defaults write com.github.autopkg RECIPE_OVERRIDE_DIRS $(pwd)/RecipeOverrides/
defaults write com.github.autopkg RECIPE_REPO_DIR $(pwd)/repos/ defaults write com.github.autopkg RECIPE_REPO_DIR $(pwd)/repos/
@@ -59,16 +85,18 @@ jobs:
defaults write com.github.autopkg JSS_URL $JSS_URL defaults write com.github.autopkg JSS_URL $JSS_URL
defaults write com.github.autopkg API_USERNAME $JSS_USERNAME defaults write com.github.autopkg API_USERNAME $JSS_USERNAME
defaults write com.github.autopkg API_PASSWORD $JSS_PASSWORD defaults write com.github.autopkg API_PASSWORD $JSS_PASSWORD
defaults write com.github.autopkg GITHUB_TOKEN $GH_TOKEN
- name: Clone AutoPkg parent repos - name: Clone AutoPkg parent repos
if: steps.filter.outputs.recipes == 'true'
run: | run: |
for repo in $(cat repo_list.txt); do autopkg repo-add $repo && autopkg repo-update $repo; done for repo in $(cat repo_list.txt); do autopkg repo-add $repo && autopkg repo-update $repo; done
- name: Verify trust info - name: Verify trust info
if: steps.filter.outputs.recipes == 'true'
run: | run: |
for recipe in "$NEW_RECIPES"; do autopkg verify-trust-info -vv $recipe; done while read recipe; do autopkg verify-trust-info -vv "$recipe"; done < <(cat /tmp/new_recipes.txt)
- name: Run recipes - name: Run recipes
if: steps.filter.outputs.recipes == 'true'
run: | run: |
for recipe in "$NEW_RECIPES"; do autopkg run -vv $recipe --key STOP_IF_NO_JSS_UPLOAD=False; done while read recipe; do autopkg run -vvvv "$recipe" --key STOP_IF_NO_JSS_UPLOAD=False; done < <(cat /tmp/new_recipes.txt)