Skip to content

Attemp #4: Fix for release tagging process #13

Attemp #4: Fix for release tagging process

Attemp #4: Fix for release tagging process #13

name: .NET Core Desktop
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: windows-latest # For a list of available runner types, refer to
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
# Install the .NET Core workload
- name: Install .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
uses: microsoft/[email protected]
- name: Restore Packages
shell: pwsh
run: |
cd ./NEXImageControlPanel
dotnet restore
- uses: actions/cache@v1
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} #hash of project files
restore-keys: |
${{ runner.os }}-nuget-
- name: Build and Publish
shell: pwsh
run: |
cd ./NEXImageControlPanel
dotnet publish -o ./dist
cd ./dist
7z a ../../distro.zip .
cd ..
- name: Set Dist Version
id: set-dist-ver
run: |
$BUILD_NUMBER="${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}"
echo "DIST_VERSION=${$BUILD_NUMBER}" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ steps.set-dist-ver.outputs.DIST_VERSION }}
release_name: Release ${{ steps.set-dist-ver.outputs.DIST_VERSION }} for ${{ github.sha }}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./distro.zip
asset_name: distro.zip
asset_content_type: application/zip