update struct #20
This file contains hidden or 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: Build and Release | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup MSBuild | |
| uses: microsoft/setup-msbuild@v2 | |
| - name: Setup dependencies | |
| run: | | |
| .\premake5.exe setup-deps | |
| .\premake5.exe vs2022 | |
| - name: Build Release | |
| run: | | |
| msbuild GTAAudioMetadataTool.sln /p:Configuration=Release /p:Platform=x64 /m | |
| - name: Prepare release artifacts | |
| run: | | |
| mkdir release | |
| copy "bin\Release-windows-x86_64\ivam\ivam.exe" release\ | |
| copy "Hashes.txt" release\ | |
| copy "README.md" release\ | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: GTAAudioMetadataTool-${{ github.sha }} | |
| path: release/ | |
| release: | |
| needs: build | |
| runs-on: windows-latest | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: GTAAudioMetadataTool-${{ github.sha }} | |
| path: release/ | |
| - name: Get commit info and calculate version | |
| id: version | |
| run: | | |
| $shortSha = "${{ github.sha }}".Substring(0, 7) | |
| $commitMsg = git log -1 --pretty=format:"%s" | |
| # Get the latest release version | |
| try { | |
| $latestRelease = gh release list --limit 1 --json tagName | ConvertFrom-Json | |
| if ($latestRelease.Count -gt 0) { | |
| $latestTag = $latestRelease[0].tagName | |
| if ($latestTag -match '^v?(\d+)\.(\d+)\.(\d+)$') { | |
| $major = [int]$matches[1] | |
| $minor = [int]$matches[2] | |
| $patch = [int]$matches[3] | |
| # Increment patch version | |
| $patch++ | |
| # if patch reaches 10, increment minor and reset patch | |
| if ($patch -eq 10) { | |
| $minor++ | |
| $patch = 0 | |
| } | |
| # if minor reaches 10, increment major and reset minor | |
| if ($minor -eq 10) { | |
| $major++ | |
| $minor = 0 | |
| } | |
| $newVersion = "$major.$minor.$patch" | |
| } else { | |
| $newVersion = "1.0.0" | |
| } | |
| } else { | |
| $newVersion = "1.0.0" | |
| } | |
| } catch { | |
| $newVersion = "1.0.0" | |
| } | |
| echo "version=$newVersion" >> $env:GITHUB_OUTPUT | |
| echo "short_sha=$shortSha" >> $env:GITHUB_OUTPUT | |
| echo "commit_message=$commitMsg" >> $env:GITHUB_OUTPUT | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: v${{ steps.version.outputs.version }} | |
| name: "Release v${{ steps.version.outputs.version }}" | |
| body: | | |
| **Automated release from commit:** ${{ github.sha }} | |
| **Commit message:** ${{ steps.version.outputs.commit_message }} | |
| **Usage:** | |
| 1. Download and extract the release | |
| 2. Place your GTA IV metadata files next to ivam.exe | |
| 3. Run `ivam.exe` to convert binary files to JSON | |
| 4. Run `ivam.exe gen` to convert JSON files back to binary | |
| files: | | |
| release/ivam.exe | |
| release/Hashes.txt | |
| release/README.md | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |