Update GitHub actions from v3 to v4 #32
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
release: | |
types: [published] | |
env: | |
PROJECT_TYPE: KEXT | |
jobs: | |
build: | |
name: Kext Build | |
runs-on: macos-latest | |
env: | |
JOB_TYPE: BUILD | |
steps: | |
- name: Checkout VoodooI2C | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
fetch-depth: 500 | |
- name: Checkout MacKernelSDK | |
uses: actions/checkout@v4 | |
with: | |
repository: acidanthera/MacKernelSDK | |
path: MacKernelSDK | |
- name: CI Bootstrap | |
run: | | |
src=$(/usr/bin/curl -Lfs https://raw.githubusercontent.com/acidanthera/ocbuild/master/ci-bootstrap.sh) && eval "$src" || exit 1 | |
- name: VoodooInput Bootstrap | |
run: | | |
src=$(/usr/bin/curl -Lfs https://raw.githubusercontent.com/acidanthera/VoodooInput/master/VoodooInput/Scripts/bootstrap.sh) && eval "$src" && mv VoodooInput Dependencies | |
- name: Fetch tags | |
run: git fetch --tags --recurse-submodules=no | |
- name: Get Commit SHA | |
id: vars | |
run: | | |
echo "sha_short=$(git rev-parse --short=8 ${{ github.sha }})" >> $GITHUB_OUTPUT | |
- name: Build Debug VoodooI2C | |
run: xcodebuild -workspace VoodooI2C.xcworkspace -scheme VoodooI2C -derivedDataPath build -jobs 1 -configuration Debug | |
- name: Build Release VoodooI2C | |
run: xcodebuild -workspace VoodooI2C.xcworkspace -scheme VoodooI2C -derivedDataPath build -jobs 1 -configuration Release | |
- name: Generate Release Description | |
if: github.event_name == 'release' | |
run: | | |
LAST_TAG=$(git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`) | |
LAST_TEN_COMMITS=$(git log --oneline --pretty=format:"%h - %s (%an)" ${LAST_TAG}..@ -n 10) | |
NEW_LINES=$'\n\n\n' | |
NUM_COMMITS="$(git rev-list ${LAST_TAG}..@ --count)" | |
echo "Since the last release there have been ${NUM_COMMITS} commit(s). The descriptions for the first (at most) 10 of these are as follows${NEW_LINES}${LAST_TEN_COMMITS}" >> ./changelog.md | |
- uses: softprops/action-gh-release@v2 | |
if: github.event_name == 'release' | |
with: | |
files: build/Build/Products/*/*.zip | |
body_path: ./changelog.md | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: VoodooI2C-${{ steps.vars.outputs.sha_short }} | |
path: build/Build/Products/*/*.zip | |
docs: | |
name: Docs | |
runs-on: macos-latest | |
steps: | |
- name: Checkout VoodooI2C | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- name: Checkout MacKernelSDK | |
uses: actions/checkout@v4 | |
with: | |
repository: acidanthera/MacKernelSDK | |
path: MacKernelSDK | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
cache: 'pip' | |
- name: Install python dependencies | |
run: pip3 install -r requirements.txt | |
- name: VoodooInput Bootstrap | |
run: | | |
src=$(/usr/bin/curl -Lfs https://raw.githubusercontent.com/acidanthera/VoodooInput/master/VoodooInput/Scripts/bootstrap.sh) && eval "$src" && mv VoodooInput Dependencies | |
- name: Build Documentation | |
run: ./scripts/build_doc.sh | |
- name: Package Documentation | |
run: zip -r Docs.zip ./docs/* | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: VoodooI2C-Docs | |
path: Docs.zip | |
- name: Upload Docs to Github Pages | |
if: ${{ (github.event_name == 'release') && (github.event.repository.full_name == 'VoodooI2C/VoodooI2C') }} | |
working-directory: ./docs | |
env: | |
DOCUMENTATION_TOKEN: ${{ secrets.DOCUMENTATION_TOKEN }} | |
USERNAME: github-actions[bot] | |
run: | | |
git init . | |
git config user.name "$USERNAME" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add -A | |
git commit -m "${{ github.ref_name}} Documentation" | |
git push -f https://$USERNAME:$DOCUMENTATION_TOKEN@github.com/VoodooI2C/VoodooI2C.github.io.git master | |
lint: | |
name: Lint | |
runs-on: macos-latest | |
steps: | |
- name: Checkout VoodooI2C | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- name: Checkout MacKernelSDK | |
uses: actions/checkout@v4 | |
with: | |
repository: acidanthera/MacKernelSDK | |
path: MacKernelSDK | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
cache: 'pip' | |
- name: Install python dependencies | |
run: pip3 install -r requirements.txt | |
- name: Run Lint | |
run: ./scripts/run_lint.sh |