Skip to content

AutoPkg run

AutoPkg run #95

Workflow file for this run

name: AutoPkg run
on:
schedule:
- cron: '23 4 * * 2,4,6' # At 04:00 on Tuesday, Thursday, and Saturday.
workflow_dispatch: # manually triggered
inputs:
recipe:
description: Recipe to Run (optional)
required: false
jobs:
AutoPkg:
runs-on: macos-latest
timeout-minutes: 150 # Keeps your builds from running too long
env:
MUNKI_VERSION: 6.3.1
MUNKI_EXPLICIT_VERSION: 6.3.1.4580
AUTOPKG_VERSION: 2.7.2
PYTHON_VERSION: 3.11.4
steps:
- id: create_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
- name: Checkout this repo
uses: actions/checkout@v3
with:
token: ${{ steps.create_token.outputs.token }}
- name: Install Munki
uses: joncrain/macos-pkg-install@v1.0
with:
pkg_url: https://github.com/munki/munki/releases/download/v${{ env.MUNKI_VERSION }}/munkitools-${{ env.MUNKI_EXPLICIT_VERSION }}.pkg
- name: Install AutoPkg
uses: joncrain/macos-pkg-install@v1.0
with:
pkg_url: https://github.com/autopkg/autopkg/releases/download/v${{ env.AUTOPKG_VERSION }}/autopkg-${{ env.AUTOPKG_VERSION }}.pkg
- name: Configure AutoPkg
run: |
/usr/bin/defaults write com.github.autopkg RECIPE_OVERRIDE_DIRS "$GITHUB_WORKSPACE"/autopkg_src/overrides/
/usr/bin/defaults write com.github.autopkg RECIPE_REPO_DIR "$GITHUB_WORKSPACE"/autopkg_src/repos/
/usr/bin/defaults write com.github.autopkg FAIL_RECIPES_WITHOUT_TRUST_INFO -bool YES
/usr/bin/defaults write com.github.autopkg MUNKI_REPO "$GITHUB_WORKSPACE"
/usr/bin/defaults write com.github.autopkg GITHUB_TOKEN "${{ steps.create_token.outputs.token }}"
/bin/mkdir ./pkgs/
/bin/mkdir -p /var/tmp/autopkg/
/usr/bin/git config --global user.name "runner"
/usr/bin/git config --global user.email "runner@githubactions.local"
/bin/mkdir -p /Users/runner/Library/AutoPkg/
/bin/ln -s "$GITHUB_WORKSPACE"/autopkg_src/Recipes /Users/runner/Library/AutoPkg/
- name: Configure AutoPkg Repos
run: |
for repo in $(/bin/cat ./autopkg_src/repo_list.txt); do /usr/local/bin/autopkg repo-add "$repo"; done
- name: Run makecatalogs
run: /usr/local/munki/makecatalogs ./ -s
- uses: actions/setup-python@v4
if: steps.python-cache.outputs.cache-hit != 'true'
with:
python-version: ${{ env.PYTHON_VERSION }}
- uses: actions/cache@v3
id: python-cache
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('./autopkg_src/requirements.txt') }}
- name: pip Install
run: pip install -r ./autopkg_src/requirements.txt
- name: Run AutoPkg
run: |
python3 ./autopkg_src/autopkg_tools.py -l ./autopkg_src/recipe_list.json
env:
RECIPE: ${{ github.event.inputs.recipe }}
SUMMARY_WEBHOOK_TOKEN: ${{ secrets.SUMMARY_WEBHOOK_TOKEN }}
GITHUB_TOKEN: ${{ steps.create_token.outputs.token }}
MUNKI_WEBSITE: ${{ vars.MUNKI_WEBSITE }}
# - name: Configure AWS credentials
# if: always()
# uses: aws-actions/configure-aws-credentials@v2
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# aws-region: us-east-1
# - name: Push packages to Storage Bucket
# if: always()
# run: |
# aws s3 sync ./pkgs/ s3://${{secrets.AWS_S3_BUCKET}}/pkgs/
- name: Gather Logs
run: |
/usr/bin/tar -czvf /var/tmp/autopkg.tar.gz /var/tmp/autopkg/
- name: Upload log file
uses: actions/upload-artifact@v3
with:
name: autopkg_log
path: /var/tmp/autopkg.tar.gz