Download Original Dll files #38
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: Download Original Dll files | |
on: | |
workflow_call: | |
inputs: | |
arch: | |
description: 'Arch' | |
required: true | |
type: string | |
version: | |
description: 'Version(e.g. 22H2)' | |
required: false | |
type: string | |
build: | |
description: 'Build(e.g. 22621)' | |
required: true | |
type: string | |
url: | |
description: 'Download URL' | |
required: true | |
type: string | |
format: | |
description: 'File Format' | |
required: true | |
type: string | |
default: .iso | |
upload: | |
description: 'Upload' | |
required: true | |
type: string | |
workflow_dispatch: | |
inputs: | |
arch: | |
description: 'Arch' | |
required: true | |
type: choice | |
options: | |
- x64 | |
- arm64 | |
version: | |
description: 'Version(e.g. 22H2)' | |
required: false | |
type: string | |
build: | |
description: 'Build(e.g. 22621)' | |
required: true | |
type: string | |
url: | |
description: 'Download URL' | |
required: true | |
type: string | |
format: | |
description: 'File Format' | |
required: true | |
type: choice | |
options: | |
- .iso | |
- .wim | |
- .esd | |
- .vhdx | |
- .zip | |
default: .iso | |
upload: | |
description: 'Upload' | |
required: true | |
type: choice | |
options: | |
- true | |
- false | |
default: 'false' | |
env: | |
ARCH: ${{ inputs.arch }} | |
VERSION: ${{ inputs.version }} | |
BUILD: ${{ inputs.build }} | |
URL: ${{ inputs.url }} | |
FORMAT: ${{ inputs.format }} | |
UPLOAD: ${{ inputs.upload }} | |
jobs: | |
download: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo modprobe nbd max_part=8 | |
sudo apt update | |
sudo apt install -y qemu-kvm wimtools unzip curl | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
check-latest: true | |
python-version: '3.9' | |
- name: Download | |
run: | | |
echo "Arch: $ARCH" | |
echo "Version: $VERSION" | |
echo "Build: $BUILD" | |
echo "Download URL: $URL" | |
echo "Format: $FORMAT" | |
echo "Upload: $UPLOAD" | |
mkdir original_dll/ 2>/dev/null || : | |
mkdir original_dll/x64 2>/dev/null || : | |
mkdir original_dll/arm64 2>/dev/null || : | |
mkdir original_dll/$ARCH/$BUILD | |
echo "Arch: $ARCH" >> original_dll/$ARCH/$BUILD/info.txt | |
echo "Version: $VERSION" >> original_dll/$ARCH/$BUILD/info.txt | |
echo "Build: $BUILD" >> original_dll/$ARCH/$BUILD/info.txt | |
echo "Download URL: $URL" >> original_dll/$ARCH/$BUILD/info.txt | |
echo "Format: $FORMAT" >> original_dll/$ARCH/$BUILD/info.txt | |
mkdir tmp | |
cd tmp | |
curl -o "Windows$FORMAT" "$URL" | |
ls -lh | |
- name: VHDX | |
if: env.FORMAT == '.vhdx' | |
run: | | |
cd tmp | |
sudo qemu-nbd -f vhdx -c /dev/nbd7 Windows.vhdx | |
sudo fdisk -l /dev/nbd7 | |
mkdir Windows | |
ls /dev/nbd7* | |
sudo mount $(python3 ../scripts/DownloadDll_vhdx.py $(ls /dev/nbd7*)) Windows | |
cp Windows/Windows/System32/icu.dll ../original_dll/$ARCH/$BUILD | |
cp Windows/Windows/System32/winhttp.dll ../original_dll/$ARCH/$BUILD | |
sudo umount Windows | |
- name: ISO | |
if: env.FORMAT == '.iso' | |
run: | | |
cd tmp | |
mkdir iso | |
sudo mount -o loop Windows.iso iso | |
export file_path=$(ls iso/sources/install.*) | |
mkdir dll | |
wimextract $file_path 1 /Windows/System32/icu.dll --dest-dir=dll | |
wimextract $file_path 1 /Windows/System32/winhttp.dll --dest-dir=dll | |
cp dll/* ../original_dll/$ARCH/$BUILD | |
sudo umount iso | |
- name: WIM/ESD | |
if: env.format == '.wim' || env.format == '.esd' | |
run: | | |
cd tmp | |
mkdir dll | |
wimextract Windows$FORMAT 1 /Windows/System32/icu.dll --dest-dir=dll | |
wimextract Windows$FORMAT 1 /Windows/System32/winhttp.dll --dest-dir=dll | |
cp dll/* ../original_dll/$ARCH/$BUILD | |
- name: ZIP | |
if: env.FORMAT == '.zip' | |
run: | | |
cd tmp | |
mkdir zip | |
mkdir iso | |
mkdir dll | |
python3 ../scripts/DownloadDll_zip.py | |
cp dll/* ../original_dll/$ARCH/$BUILD | |
- name: Creat Artifact | |
run: | | |
cd tmp | |
mkdir artifact | |
cp ../original_dll/$ARCH/$BUILD/* artifact | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: original_dll | |
path: tmp/artifact | |
- name: Delete tmp | |
run: | | |
rm -rf tmp | |
- name: commit | |
if: github.event.inputs.upload== 'true' | |
run: | | |
git config --global user.email github-actions[bot]@users.noreply.github.com | |
git config --global user.name github-actions[bot] | |
git add original_dll/$ARCH/$BUILD | |
git commit -m "Upload original dlls from $VERSION $ARCH build $BUILD" | |
git pull | |
- name: Push changes | |
if: github.event.inputs.upload== 'true' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
DllInject: | |
needs: download | |
if: github.event.inputs.upload== 'true' | |
uses: ./.github/workflows/DllInject.yml |