无法升级系统 #33
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
# | |
# Copyright (C) 2022 Ing <https://github.com/wjz304> | |
# | |
# This is free software, licensed under the MIT License. | |
# See /LICENSE for more information. | |
# | |
name: Custom EFI | |
on: | |
issues: | |
types: [opened] | |
workflow_dispatch: | |
inputs: | |
ocver: | |
description: 'rel | pre | mod' | |
required: true | |
default: 'mod' | |
type: choice | |
options: | |
- rel | |
- pre | |
- mod | |
itlwm: | |
description: 'sonoma | ventura | monterey | big_sur' | |
required: true | |
default: 'ventura' | |
type: choice | |
options: | |
- sonoma | |
- ventura | |
- monterey | |
- big_sur | |
kexts: | |
description: 'stable | alpha' | |
required: true | |
default: 'alpha' | |
type: choice | |
options: | |
- stable | |
- alpha | |
env: | |
FORCE_INSTALL: 1 | |
HAS_OPENSSL_BUILD: 1 | |
HAS_OPENSSL_W32BUILD: 0 | |
ACID32: 1 | |
jobs: | |
build: | |
runs-on: macos-12 | |
steps: | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.1.2 | |
- name: Set up Python 3 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Checkout | |
uses: actions/checkout@main | |
- name: Get Info | |
run: | | |
if [ ${{ github.event_name }} == 'issues' ]; then | |
# https://docs.github.com/cn/rest/issues/events | |
title=$(echo ${{ github.event.issue.title }} | tr '[:upper:]' '[:lower:]') | |
if [ ${title:0:6} == 'custom' ]; then | |
echo "issues=true" >> $GITHUB_ENV | |
iscustom=true | |
ocver=$(echo '${{ github.event.issue.body }}' | jq -r .ocver) | |
itlwm=$(echo '${{ github.event.issue.body }}' | jq -r .itlwm) | |
kexts=$(echo '${{ github.event.issue.body }}' | jq -r .kexts) | |
ARR=(rel pre mod) | |
if [ ${ARR[@]} != ${ocver} ]; then | |
iscustom=false | |
fi | |
ARR=(sonoma ventura monterey big_sur) | |
if [ ${ARR[@]} != ${itlwm} ]; then | |
iscustom=false | |
fi | |
ARR=(stable alpha) | |
if [ ${ARR[@]} != ${kexts} ]; then | |
iscustom=false | |
fi | |
echo "iscustom=${iscustom}" >> $GITHUB_ENV | |
if [ ${iscustom} == 'true' ]; then | |
echo "ocver=${ocver}" >> $GITHUB_ENV | |
echo "itlwm=${itlwm}" >> $GITHUB_ENV | |
echo "kexts=${kexts}" >> $GITHUB_ENV | |
fi | |
else | |
echo "issues=false" >> $GITHUB_ENV | |
echo "iscustom=false" >> $GITHUB_ENV | |
fi | |
else | |
echo "issues=false" >> $GITHUB_ENV | |
echo "iscustom=true" >> $GITHUB_ENV | |
echo "ocver=${{ inputs.ocver }}" >> $GITHUB_ENV | |
echo "itlwm=${{ inputs.itlwm }}" >> $GITHUB_ENV | |
echo "kexts=${{ inputs.kexts }}" >> $GITHUB_ENV | |
fi | |
echo issues: ${{ env.issues }} | |
echo iscustom: ${{ env.iscustom }} | |
echo ocver: ${{ env.ocver }} | |
echo itlwm: ${{ env.itlwm }} | |
echo kexts: ${{ env.kexts }} | |
- name: Add labels | |
if: env.issues == 'true' && env.iscustom == 'true' | |
uses: actions-cool/issues-helper@v3 | |
with: | |
actions: 'add-labels' | |
token: ${{ secrets.GITHUB_TOKEN }} | |
issue-number: ${{ github.event.issue.number }} | |
labels: 'custom' | |
- name: Create comment | |
if: env.issues == 'true' && env.iscustom == 'true' | |
uses: actions-cool/issues-helper@v3 | |
with: | |
actions: 'create-comment' | |
token: ${{ secrets.GITHUB_TOKEN }} | |
issue-number: ${{ github.event.issue.number }} | |
body: | | |
${{ github.event.issue.user.login }} 您好. | |
您自定义的 EFI 已开始构建. 请前往下面的 URL 查看详细信息. | |
> ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
---- | |
Hello ${{ github.event.issue.user.login }}. | |
Your customized EFI has started building. Please click the URL below to view the details. | |
> ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
emoji: heart | |
- name: Create comment | |
if: env.issues == 'true' && env.iscustom == 'false' | |
uses: actions-cool/issues-helper@v3 | |
with: | |
actions: 'create-comment' | |
token: ${{ secrets.GITHUB_TOKEN }} | |
issue-number: ${{ github.event.issue.number }} | |
body: | | |
${{ github.event.issue.user.login }} 您好. | |
您自定义 EFI 所填写的信息无法解析, 请参考模板并请重新发起定制. | |
> | |
---- | |
Hello ${{ github.event.issue.user.login }}. | |
The information filled in by your customized EFI cannot be parsed. Please refer to the template and restart customization. | |
> | |
emoji: confused | |
- name: Initialization environment | |
if: env.iscustom == 'true' | |
run : | | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
sudo systemsetup -settimezone "Asia/Shanghai" | |
- name: Install Python Dependencies | |
if: env.iscustom == 'true' | |
run: | | |
python3 -m pip install -U pip | |
pip3 install datetime urllib3 wget | |
- name: Run Updater | |
if: env.iscustom == 'true' | |
run: | | |
echo "OCVer: ${{ inputs.ocver }}" > custom.txt | |
echo "itlwm: ${{ inputs.itlwm }}" >> custom.txt | |
echo "kexts: ${{ inputs.kexts }}" >> custom.txt | |
python3 -u update.py -o ${{ inputs.ocver }} -i ${{ inputs.itlwm }} -k ${{ inputs.kexts }} -t ${{ secrets.GITHUB_TOKEN }} | |
- name: Generate release tag | |
if: env.iscustom == 'true' | |
run: | | |
echo "### EFI Custom" >> $GITHUB_STEP_SUMMARY | |
if [ ${{ env.iscustom }} == 'true' ]; then | |
echo "👉 issues: [#${{ github.event.issue.number }}]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/issues/${{ github.event.issue.number }})" >> $GITHUB_STEP_SUMMARY | |
else | |
echo "👉 Custom: {ocver: ${{ env.ocver }}, itlwm: ${{ env.itlwm }}, kexts: ${{ env.kexts }}}" >> $GITHUB_STEP_SUMMARY | |
fi | |
echo "release_tag=$(date +"%Y.%m.%d-%H%M")" >> $GITHUB_ENV | |
- name: Upload to Artifacts | |
if: env.iscustom == 'true' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ github.event.repository.name }}-Custom-${{ env.release_tag }} | |
path: | | |
EFI | |
README.md | |
custom.txt | |
- name: Create comment | |
if: env.issues == 'true' && env.iscustom == 'true' | |
uses: actions-cool/issues-helper@v3 | |
with: | |
actions: 'create-comment' | |
token: ${{ secrets.GITHUB_TOKEN }} | |
issue-number: ${{ github.event.issue.number }} | |
body: | | |
${{ github.event.issue.user.login }} 您好. | |
您自定义的 EFI 已构建完成. 请前往下面的 URL 下载. | |
> ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
---- | |
Hello ${{ github.event.issue.user.login }}. | |
Your customized EFI has been builded. Please click the URL below to download it. | |
> ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
emoji: hooray | |
- name: Close issue | |
if: env.issues == 'true' && env.iscustom == 'true' | |
uses: actions-cool/issues-helper@v3 | |
with: | |
actions: 'close-issue' | |
token: ${{ secrets.GITHUB_TOKEN }} | |
issue-number: ${{ github.event.issue.number }} |