Commit af2616a2 authored by Jai Luthra's avatar Jai Luthra Committed by GitHub

Merge pull request #682 from reloxx13/add_gh_action

Add github action for windows patches
parents 4ce52a4b 2fa2dc6b
# GitHub Actions usage
To create patches to a new driver version simply create a new release with the following name schema:
- For DCH: `win-dch-536.67`
- For Studio: `win-studio-536.67`
- If you need to rerun append `-{try}` e.g. `win-dch-536.67-2`
Tagname same as release name.
If the patch file exist for a version, they will get deleted and recreated.
The patches will be added as asset to the release.
> Currently only for windows10 patches
\ No newline at end of file
name: Generate Windows patches
on:
release:
types:
- created
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check release name and OS
id: check_release
run: |
release_name="${{ github.event.release.tag_name }}"
echo "Release Name: $release_name"
if [[ $release_name =~ (win)-(dch|studio)-([0-9]+\.[0-9]+(-[a-zA-Z]+)?)(-.+)? ]]; then
os="${BASH_REMATCH[1]}"
variant="${BASH_REMATCH[2]}"
version="${BASH_REMATCH[3]}"
echo "Operating System: $os"
echo "Variant: $variant"
echo "Version: $version"
if [ "$os" != "win" ]; then
echo "Not a Windows release. Stopping the CI workflow."
exit 0
fi
if [ "$variant" == "dch" ]; then
variant="DCH"
fi
echo "OS=$os" >> $GITHUB_ENV
echo "VARIANT=$variant" >> $GITHUB_ENV
echo "VERSION=$version" >> $GITHUB_ENV
else
echo "Invalid release name format. Must be in the format 'win-dch-123.45' or 'win-studio-123.45'"
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"
rm -f "${{ github.workspace }}/win/win10_x64/${{ env.VERSION }}/nvencodeapi64.1337"
rm -f "${{ github.workspace }}/win/win10_x64/${{ env.VERSION }}/nvencodeapi.1337"
echo "Existing files deleted successfully"
- name: Run autopatch.py
run: |
echo "Running autopatch.py with version ${{ env.VERSION }}"
cd "${{ github.workspace }}/win/tools/autopatch"
python autopatch.py ${{ env.VERSION }}
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 "action@github.com"
git config --local user.name "GitHub Action"
git add -A
git diff --quiet --exit-code --cached || git commit -m "${{ env.OS }}: add support for ${{ env.VARIANT }} driver ${{ env.VERSION }}"
git push origin master
echo "Committed and pushed changes"
- name: Upload Patch Files
uses: softprops/action-gh-release@v1
with:
files: |
${{ github.workspace }}/win/win10_x64/${{ env.VERSION }}/nvencodeapi64.1337
${{ github.workspace }}/win/win10_x64/${{ env.VERSION }}/nvencodeapi.1337
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_NAME: ${{ github.event.release.tag_name }}
......@@ -111,5 +111,4 @@ venv.bak/
# dont commit 7zip files 7z.dll 7z.exe
7z.*
temp/*
!.gitempty
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment