update #3736
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: update | |
on: | |
push: | |
schedule: | |
- cron: '0 */6 * * *' | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'tag' | |
required: true | |
type: string | |
env: | |
FORCE_INSTALL: 1 | |
HAS_OPENSSL_BUILD: 1 | |
HAS_OPENSSL_W32BUILD: 0 | |
ACID32: 1 | |
jobs: | |
build: | |
name: macOS XCODE5 | |
runs-on: macos-latest | |
env: | |
JOB_TYPE: BUILD | |
HOMEBREW_NO_INSTALL_CLEANUP: 1 | |
HOMEBREW_NO_AUTO_UPDATE: 1 | |
steps: | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.3' | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Checkout | |
uses: actions/checkout@main | |
- name: Initialization environment | |
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 | |
run: | | |
python3 -m pip install -U pip | |
pip3 install datetime urllib3 wget | |
- name: Run Updater | |
run: python3 -u update.py -i sequoia,sonoma,ventura,monterey -t ${{ secrets.GITHUB_TOKEN }} | |
- name: Check for changes | |
run: | | |
if [ -n "$(git status -s | grep -v -w timestamp)" ];then | |
echo "ischanges=true" >> $GITHUB_ENV | |
## '$GITHUB_ENV' needs to add 'EOF' when setting multiline text. | |
# echo "changesbody=$(git status -s | grep -v -w timestamp)" >> $GITHUB_ENV | |
echo 'changesbody<<EOF' >> $GITHUB_ENV | |
git status -s | grep -v -w timestamp >> $GITHUB_ENV | |
echo 'EOF' >> $GITHUB_ENV | |
else | |
echo "ischanges=false" >> $GITHUB_ENV | |
fi | |
echo ischanges: ${{ env.ischanges }} | |
echo changesbody: ${{ env.changesbody }} | |
- name: Commit and Push | |
if: env.ischanges == 'true' | |
run: | | |
git add . | |
git commit -m "update $(date +%Y-%m-%d" "%H:%M:%S)" | |
git push -f | |
- name: Generate release tag | |
if: env.ischanges == 'true' || github.event_name == 'workflow_dispatch' | |
id: tag | |
run: | | |
if [ ${{ env.ischanges }} == 'true' ]; then | |
echo "release_tag=$(date +"%Y.%m.%d-%H%M")" >> $GITHUB_ENV | |
else | |
echo "release_tag=${{ inputs.version }}" >> $GITHUB_ENV | |
fi | |
- name: Zip EFI | |
if: env.ischanges == 'true' || github.event_name == 'workflow_dispatch' | |
uses: vimtor/action-zip@v1.2 | |
with: | |
files: EFI README.md | |
recursive: false | |
dest: ${{ github.event.repository.name }}-${{ env.release_tag }}.zip | |
- name: Change Sequoia | |
if: env.ischanges == 'true' | |
run: python3 -u update.py -c -i sequoia -t ${{ secrets.GITHUB_TOKEN }} | |
- name: Zip EFI Sequoia | |
if: env.ischanges == 'true' | |
uses: vimtor/action-zip@v1.2 | |
with: | |
files: EFI README.md | |
recursive: false | |
dest: ${{ github.event.repository.name }}-Sequoia-${{ env.release_tag }}.zip | |
- name: Change Sonoma | |
if: env.ischanges == 'true' | |
run: python3 -u update.py -c -i sonoma -t ${{ secrets.GITHUB_TOKEN }} | |
- name: Zip EFI Sonoma | |
if: env.ischanges == 'true' | |
uses: vimtor/action-zip@v1.2 | |
with: | |
files: EFI README.md | |
recursive: false | |
dest: ${{ github.event.repository.name }}-Sonoma-${{ env.release_tag }}.zip | |
- name: Change Ventura | |
if: env.ischanges == 'true' | |
run: python3 -u update.py -c -i ventura -t ${{ secrets.GITHUB_TOKEN }} | |
- name: Zip EFI Ventura | |
if: env.ischanges == 'true' | |
uses: vimtor/action-zip@v1.2 | |
with: | |
files: EFI README.md | |
recursive: false | |
dest: ${{ github.event.repository.name }}-Ventura-${{ env.release_tag }}.zip | |
- name: Change Monterey | |
if: env.ischanges == 'true' | |
run: python3 -u update.py -c -i monterey -t ${{ secrets.GITHUB_TOKEN }} | |
- name: Zip EFI Monterey | |
if: env.ischanges == 'true' | |
uses: vimtor/action-zip@v1.2 | |
with: | |
files: EFI README.md | |
recursive: false | |
dest: ${{ github.event.repository.name }}-Monterey-${{ env.release_tag }}.zip | |
- name: Upload firmware to release | |
if: env.ischanges == 'true' || github.event_name == 'workflow_dispatch' | |
uses: softprops/action-gh-release@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.release_tag }} | |
body: ${{ env.changesbody }} | |
files: Hackintosh*.zip | |
prerelease: ${{ env.ischanges }} | |
#- name: Delete workflow runs | |
# uses: Mattraks/delete-workflow-runs@v2 | |
# with: | |
# retain_days: 1 | |
# keep_minimum_runs: 3 | |