-
Notifications
You must be signed in to change notification settings - Fork 38
97 lines (79 loc) · 3.54 KB
/
autorelease.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# 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