Generate Windows patches #16
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: Generate Windows patches | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Driver Version' | |
required: true | |
type: string | |
variant: | |
description: 'Driver Variant' | |
required: false | |
type: choice | |
options: | |
- DCH | |
- Studio Driver | |
- DCH (Hotfix) | |
description: | |
description: 'Commit description' | |
required: false | |
type: string | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Check variant | |
id: check_input | |
run: | | |
variant="${{ inputs.variant }}" | |
version="${{ inputs.version }}" | |
echo "Operating System: $os" | |
echo "Variant: $variant" | |
echo "Version: $version" | |
if [[ $version =~ ([0-9]+\.[0-9]+(-[a-zA-Z]+)?)(-.+)? ]]; then | |
echo "VARIANT=$variant" >> $GITHUB_ENV | |
echo "VERSION=$version" >> $GITHUB_ENV | |
else | |
echo "Invalid driver version." | |
exit 1 | |
fi | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
ref: master | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Delete Existing Files | |
run: | | |
echo "Deleting existing files if they exist" | |
dir=${{ env.VERSION }} | |
if [ "${{ env.VARIANT }}" == "Studio Driver" ]; then | |
dir=nsd_${{ env.VERSION }} | |
fi | |
rm -f "${{ github.workspace }}/win/win10_x64/$dir/nvencodeapi64.1337" | |
rm -f "${{ github.workspace }}/win/win10_x64/$dir/nvencodeapi.1337" | |
echo "Existing files deleted successfully" | |
- name: Run autopatch.py | |
run: | | |
echo "Running autopatch.py with version ${{ env.VERSION }} and variant ${{ env.VARIANT }}" | |
cd "${{ github.workspace }}/win/tools/autopatch" | |
if [ "${{ env.VARIANT }}" == "DCH" ]; then | |
python autopatch.py ${{ env.VERSION }} | |
elif [ "${{ env.VARIANT }}" == "Studio Driver" ]; then | |
python autopatch.py https://international.download.nvidia.com/Windows/${{ env.VERSION }}/${{ env.VERSION }}-desktop-win10-win11-64bit-international-nsd-dch-whql.exe | |
elif [ "${{ env.VARIANT }}" == "DCH (Hotfix)" ]; then | |
python autopatch.py https://international.download.nvidia.com/Windows/${{ env.VERSION }}hf/${{ env.VERSION }}-desktop-notebook-win10-win11-64bit-international-dch.hf.exe | |
fi | |
echo "autopatch.py executed successfully" | |
- name: Run add_driver.py | |
run: | | |
echo "Running add_driver.py with variant ${{ env.VARIANT }} and version ${{ env.VERSION }}" | |
cd "${{ github.workspace }}/tools/readme-autogen" | |
python add_driver.py -W -P GeForce --variant "${{ env.VARIANT }}" -w win10 ${{ env.VERSION }} | |
echo "add_driver.py executed successfully" | |
- name: Run readme_autogen.py | |
run: | | |
echo "Running readme_autogen.py" | |
cd "${{ github.workspace }}/tools/readme-autogen" | |
python readme_autogen.py | |
echo "readme_autogen.py executed successfully" | |
- name: Commit and push changes | |
run: | | |
echo "Committing and pushing changes" | |
cd "${{ github.workspace }}" | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git checkout -b ${{ env.VERSION }} | |
git add -A | |
git diff --quiet --exit-code --cached || git commit -m "win: add support for ${{ env.VARIANT }} driver ${{ env.VERSION }}" -m "${{ inputs.description }}" | |
git push origin ${{ env.VERSION }} | |
echo "Committed and pushed changes" |