Skip to content

1.0.1.2: Update AutomaticRelease yaml. Fix 404 exception. Cleaned up … #37

1.0.1.2: Update AutomaticRelease yaml. Fix 404 exception. Cleaned up …

1.0.1.2: Update AutomaticRelease yaml. Fix 404 exception. Cleaned up … #37

Workflow file for this run

name: "Publish"
on:
push:
branches:
- main
jobs:
release:
name: "Release"
runs-on: "windows-latest"
env:
working-directory: .
project-name: SRTPluginManager
publish-profile-name: x86
is-prerelease: true
steps:
# Checkout latest code
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
# Set some output variables
- name: Set the main environment variables based on other environment variables
id: generated-variables-1
run: |
echo '::set-output name=program-exe::${{env.project-name}}.exe'
echo '::set-output name=solution::${{env.project-name}}.sln'
echo '::set-output name=project::${{env.project-name}}/${{env.project-name}}.csproj'
echo '::set-output name=publish-directory::${{env.project-name}}/bin/Release/net5.0-windows/publish/'
# Get the project's version number
- name: Get project version
id: get_version
uses: greenygh0st/net-proj-release-version@v1
with:
PROJ_FILE: ${{steps.generated-variables-1.outputs.project}}
# Sets the zip-filename output variable based on the project version
- name: Sets the zip-filename environment variable based on the project version
id: generated-variables-2
run: |
echo '::set-output name=zip-filename::${{env.project-name}}-v${{steps.get_version.outputs.RELEASE_VERSION}}.zip'
# Install .NET
- name: Install .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
# Compiles the program and runs the publish profile
- name: Compile and run publish profile
run: |
dotnet publish ${{steps.generated-variables-1.outputs.solution}} /p:PublishProfile=${{env.publish-profile-name}}
# Zip the publish artifacts
- name: Zip the publish artifacts
run: |
Add-Type -assembly 'System.IO.Compression'
Add-Type -assembly 'System.IO.Compression.FileSystem'
[System.IO.Compression.ZipArchive]$zipFile = [System.IO.Compression.ZipFile]::Open('${{steps.generated-variables-2.outputs.zip-filename}}', ([System.IO.Compression.ZipArchiveMode]::Create))
[System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile($zipFile, '${{steps.generated-variables-1.outputs.publish-directory}}${{steps.generated-variables-1.outputs.program-exe}}', '${{steps.generated-variables-1.outputs.program-exe}}')
[System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile($zipFile, 'LICENSE', 'LICENSE')
$zipFile.Dispose()
# Pushes the release
- name: Publish release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: ${{env.is-prerelease}}
title: 'Automated Build - v${{steps.get_version.outputs.RELEASE_VERSION}}'
files: |
${{steps.generated-variables-2.outputs.zip-filename}}