Update DLL name #205
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: Check latest MTGA version on commit | |
on: | |
push: | |
paths-ignore: | |
- 'README.md' | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version' | |
required: false | |
env: | |
DLL_NAME: 'Wizards.MDN.GreProtobuf.dll' | |
jobs: | |
buildjob: | |
name: Get latest MTGA version | |
runs-on: windows-2019 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
path: ${{ github.event.repository.name }} | |
fetch-depth: 1 | |
- run: npm install | |
working-directory: ./${{ github.event.repository.name }}/.github/actions/check-version-action | |
- id: get_version | |
uses: ./MtgaProto/.github/actions/check-version-action | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@v3 | |
with: | |
repository: riQQ/MsiExtractor | |
ref: refs/heads/master | |
path: MsiExtractor | |
fetch-depth: 1 | |
- run: | | |
echo $Env:GITHUB_WORKSPACE | |
cd "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\" | |
.\MSBuild.exe $Env:GITHUB_WORKSPACE\MsiExtractor\MsiExtractor.sln | |
- id: download_msi | |
run: | | |
$msiUrl = ${{ steps.get_version.outputs.msiUrl }} | |
echo $msiUrl | |
$fileName = (([uri]$msiUrl).Segments)[-1] | |
echo $fileName | |
$msiFilePath = "$Env:GITHUB_WORKSPACE\$fileName" | |
echo $msiFilePath | |
(New-Object System.Net.WebClient).DownloadFile($msiUrl, $msiFilePath) | |
echo "msiFilePath=$msiFilePath" >> $Env:GITHUB_OUTPUT | |
- name: Run MsiExtractor | |
run: | | |
cd "$Env:GITHUB_WORKSPACE\MsiExtractor\MsiExtractor\bin\Debug" | |
.\MsiExtractor.exe ${{ steps.download_msi.outputs.msiFilePath }} "${{env.DLL_NAME}}" | |
$outputDirectory = Split-Path -Parent ${{ steps.download_msi.outputs.msiFilePath }} | |
dir "$outputDirectory" | |
- name: Checkout proto extractor | |
uses: actions/checkout@v3 | |
with: | |
repository: riQQ/proto-extractor | |
ref: refs/heads/mtgatool-formatting | |
path: proto-extractor | |
fetch-depth: 1 | |
- uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '2.1.805' # SDK Version to use | |
- name: Build proto extractor | |
run: dotnet build | |
working-directory: ${{github.workspace}}\proto-extractor\extractor | |
- name: Run proto extractor | |
id: extract-proto | |
run: | | |
dotnet run --proto3 --resolve-circular-dependancies --automatic-packaging --resolve-name-collisions --outPath "${{github.workspace}}" --libPath "${{github.workspace}}" "${{github.workspace}}\${{env.DLL_NAME}}" | |
dir "${{github.workspace}}" | |
$protoFile = Get-Childitem -Path "${{github.workspace}}" -Filter *.proto | Select -First 1 | |
echo "protoPath=$($protoFile.FullName)" >> $Env:GITHUB_OUTPUT | |
working-directory: ${{github.workspace}}\proto-extractor\extractor | |
- name: Commit proto | |
if: github.ref_name == 'master' | |
working-directory: ${{ github.event.repository.name }} | |
run: | | |
# full error details | |
$ErrorView = 'NormalView' | |
Copy-Item "${{steps.extract-proto.outputs.protoPath}}" -Destination "messages.proto" | |
git status | |
git config --global user.name 'riQQ' | |
git config --global user.email '[email protected]' | |
git add messages.proto | |
git status | |
git diff-index --quiet HEAD | |
if( $? ) | |
{ | |
echo "No changes to commit and push" | |
exit 0 | |
} | |
echo "Commiting and pushing changes" | |
git commit -m "Update proto" | |
# print progress to stdout instead of stderr to don't cause an error in powershell | |
git push --porcelain | |
- name: Upload proto as artifact | |
uses: actions/upload-artifact@v1 | |
with: | |
name: Messages.proto | |
path: ${{steps.extract-proto.outputs.protoPath}} |