Skip to content

Commit

Permalink
The most significant changes involve the main.yml file and the `Mag…
Browse files Browse the repository at this point in the history
…icChatbox.csproj` file. In the `main.yml` file, the method of extracting the version number from the `csproj` file has been altered. Instead of directly reading the XML, a regular expression is now used. If the version number is not found, an error message is displayed and the process is halted. The `GITHUB_TOKEN` used in the `main.yml` file has also been changed from `secrets.GITHUB_TOKEN` to `secrets.MY_PAT` in the 'Create Release' and 'Upload Release Asset' steps. Additionally, a comment has been added to the `upload_url` in the 'Upload Release Asset' step to indicate that it uses the output from the 'create_release' step. In the `MagicChatbox.csproj` file, the version number has been incremented from `0.8.731` to `0.8.732`.

Changes:

1. Updated the `main.yml` file to change the way the version number is extracted from the `csproj` file. It now uses a regular expression to find the version number. If the version number is not found, an error message is displayed and the process is stopped.
2. Changed the `GITHUB_TOKEN` used in the `main.yml` file from `secrets.GITHUB_TOKEN` to `secrets.MY_PAT` in both the 'Create Release' and 'Upload Release Asset' steps.
3. Added a comment to the `upload_url` in the 'Upload Release Asset' step of the `main.yml` file indicating that it uses the output from the 'create_release' step.
4. Incremented the version number in the `MagicChatbox.csproj` file from `0.8.731` to `0.8.732`.
  • Loading branch information
BoiHanny committed Jan 25, 2024
1 parent 84a5149 commit 2adf1b8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
21 changes: 15 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,18 @@ jobs:
- name: Extract Version from csproj
id: get_version
run: |
$xml = [xml](Get-Content ${{ env.Project_Path }})
$version = $xml.Project.PropertyGroup.Version
echo "::set-output name=VERSION::$version"
$csproj = "${{ env.Project_Path }}"
$pattern = '<Version>(.*)<\/Version>'
$content = Get-Content $csproj -Raw
$match = [regex]::Match($content, $pattern)
if ($match.Success -and $match.Groups.Count -gt 1) {
$version = $match.Groups[1].Value
echo "VERSION=$version" | Out-File -Append -Encoding utf8 $Env:GITHUB_ENV
echo "::set-output name=VERSION::$version"
} else {
echo "Error: Version not found in csproj file."
exit 1
}
shell: pwsh

- name: Create Zip File
Expand All @@ -43,7 +52,7 @@ jobs:
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.MY_PAT }} # Replace 'GITHUB_TOKEN' with your secret name
GITHUB_TOKEN: ${{ secrets.MY_PAT }}
with:
tag_name: v${{ steps.get_version.outputs.VERSION }}
release_name: MagicChatbox Pre-v${{ steps.get_version.outputs.VERSION }}
Expand All @@ -64,9 +73,9 @@ jobs:
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.MY_PAT }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
upload_url: ${{ steps.create_release.outputs.upload_url }} # Use the output from the create_release step
asset_path: ./MagicChatbox-${{ steps.get_version.outputs.VERSION }}.zip
asset_name: MagicChatbox-${{ steps.get_version.outputs.VERSION }}.zip
asset_content_type: application/zip
2 changes: 1 addition & 1 deletion vrcosc-magicchatbox/MagicChatbox.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<Version>0.8.731</Version>
<Version>0.8.732</Version>
<TargetFramework>net6.0-windows10.0.22000.0</TargetFramework>
<RootNamespace>vrcosc_magicchatbox</RootNamespace>
<Nullable>enable</Nullable>
Expand Down

0 comments on commit 2adf1b8

Please sign in to comment.