Merge pull request #9 from cesare-montresor/ScriptEngine #11
This file contains 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
# This is a basic workflow to help you get started with Actions | |
name: AutoRelease | |
# Controls when the action will run. | |
on: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Triggers the workflow on push or pull request events but only for the release/0.7 branch | |
push: | |
branches: [ release/0.8 ] | |
#pull_request: | |
# branches: [ release/0.7 ] | |
env: | |
# Path to the solution file relative to the root of the project. | |
SOLUTION_FILE_PATH: . | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Configuration type to build. | |
# You can convert this to a build matrix if you need coverage of multiple configuration types. | |
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
BUILD_CONFIGURATION: Debug | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Grab Version | |
id: get_version | |
shell: powershell | |
run: | | |
$version = Select-String -Path Razor/Properties/AssemblyInfo.cs -Pattern 'AssemblyVersion\(\"([\w.-]+)\"\)' -AllMatches | %{$_.Matches.Groups[1].Value} | |
echo "::set-output name=version::$version" | |
- name: Show Version | |
run: echo "${{steps.get_version.outputs.version}}" | |
- name: GitHub Tag Exists | |
uses: mukunku/[email protected] | |
id: checkTag | |
with: | |
tag: "v${{steps.get_version.outputs.version}}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- run: echo ${{ steps.checkTag.outputs.exists }} | |
# build | |
- name: Add MSBuild to PATH | |
if: ${{ steps.checkTag.outputs.exists }} == false | |
uses: microsoft/setup-msbuild@v1 | |
- name: Restore NuGet packages | |
if: ${{ steps.checkTag.outputs.exists }} == false | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: nuget restore ${{env.SOLUTION_FILE_PATH}} | |
- name: Build | |
if: ${{ steps.checkTag.outputs.exists }} == false | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
# Add additional options to the MSBuild command line here (like platform or verbosity level). | |
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference | |
run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}} | |
- name: Zip Razor | |
if: ${{ steps.checkTag.outputs.exists }} == false | |
id: create_zip | |
uses: vimtor/action-zip@v1 | |
with: | |
files: bin/Win32/Debug | |
recursive: true | |
dest: RazorEnhanced-${{ steps.get_version.outputs.version }}.zip | |
- name: Create Release | |
if: ${{ steps.checkTag.outputs.exists }} == false | |
id: create_release | |
uses: actions/create-release@v1 | |
with: | |
tag_name: "v${{steps.get_version.outputs.version}}" | |
release_name: RazorEnhanced ${{steps.get_version.outputs.version}} | |
draft: false | |
prerelease: false | |
- name: Deploy | |
if: ${{ steps.checkTag.outputs.exists }} == false | |
uses: actions/upload-release-asset@v1 | |
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: ./RazorEnhanced-${{ steps.get_version.outputs.version }}.zip | |
asset_name: RazorEnhanced-${{ steps.get_version.outputs.version }}.zip | |
asset_content_type: application/zip |