Skip to content

Commit

Permalink
The most important changes in the main.yml file are related to the …
Browse files Browse the repository at this point in the history
…configuration of a GitHub Actions workflow for a .NET Core Desktop application named MagicChatbox. The workflow is triggered on a push to the 'Pre-Master' branch and is set to run on the latest version of Windows. The workflow includes several steps such as checking out the repository, setting up .NET Core, restoring dependencies, building the solution, extracting the version from the csproj file, creating a zip file of the build output, creating a release on GitHub, and uploading the zip file as a release asset. The workflow uses the `GITHUB_TOKEN` secret for authentication.

List of changes:

1. Configuration of a GitHub Actions workflow for the MagicChatbox application. The workflow is triggered on a push to the 'Pre-Master' branch (main.yml).
2. The workflow is set to run on the latest version of Windows (main.yml).
3. The workflow includes a step for checking out the repository using the `actions/checkout@v3` action (main.yml).
4. The workflow includes a step for setting up .NET Core using the `actions/setup-dotnet@v3` action with a specified .NET version of 6.0.x (main.yml).
5. The workflow includes steps for restoring dependencies and building the solution using the `dotnet restore` and `dotnet build` commands respectively (main.yml).
6. The workflow includes a step for extracting the version from the csproj file and storing it as an output variable (main.yml).
7. The workflow includes a step for creating a zip file of the build output (main.yml).
8. The workflow includes a step for creating a release on GitHub using the `actions/create-release@v1` action, with the version number extracted earlier. The release is marked as a pre-release and includes instructions for manual download and installation of the application (main.yml).
9. The workflow includes a step for uploading the zip file created earlier as a release asset using the `actions/upload-release-asset@v1` action (main.yml).
10. The workflow uses the `GITHUB_TOKEN` secret for authentication during the creation and uploading of the release (main.yml).
  • Loading branch information
BoiHanny committed Jan 25, 2024
1 parent f645cbe commit 65e9910
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: .NET Core Desktop Build and Release

on:
push:
branches:
- 'Pre-Master'

env:
Solution_Name: vrcosc-magicchatbox.sln
Project_Path: vrcosc-magicchatbox\vrcosc_magicchatbox.csproj

jobs:
build-and-release:
runs-on: windows-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x

- name: Restore Dependencies
run: dotnet restore ${{ env.Solution_Name }}

- name: Build Solution
run: dotnet build ${{ env.Solution_Name }} --configuration Release --no-restore

- 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"
shell: pwsh

- name: Create Zip File
run: |
Compress-Archive -Path vrcosc-magicchatbox/bin/Release/net6.0-windows10.0.22000.0/win-x64/* -DestinationPath "MagicChatbox-${{ steps.get_version.outputs.VERSION }}.zip"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.get_version.outputs.VERSION }}
release_name: MagicChatbox Pre-v${{ steps.get_version.outputs.VERSION }}
draft: false
prerelease: true
body: |
# MagicChatbox Pre-v${{ steps.get_version.outputs.VERSION }} ![GitHub release (latest by date)](https://img.shields.io/github/downloads/BoiHanny/vrcosc-magicchatbox/v${{ steps.get_version.outputs.VERSION }}/total?color=%23AB3BFF&label=Version%20downloads&logo=%20&style=plastic)
<!-- BEGIN LATEST DOWNLOAD BUTTON -->
# Download the latest version and update in the app.
### Manual Download and Installation
1. Download the .zip
2. Make sure you have [.NET 6](https://dotnet.microsoft.com/en-us/download) installed.
3. Right-click and choose the option 'extract all'.
4. By default it will create a new folder in your download folder (you can also extract the content to other locations).
5. When extracted, the folder will open.
6. Run the file 'MagicChatbox.exe'.
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./MagicChatbox-${{ steps.get_version.outputs.VERSION }}.zip
asset_name: MagicChatbox-${{ steps.get_version.outputs.VERSION }}.zip
asset_content_type: application/zip

0 comments on commit 65e9910

Please sign in to comment.