-
Notifications
You must be signed in to change notification settings - Fork 6
118 lines (118 loc) · 5.73 KB
/
build.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: build
on:
workflow_dispatch:
push:
branches: [master,dev]
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
pull_request:
branches: [master]
jobs:
build:
runs-on: windows-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v2
- id: checkpcfconfig
run: |
get-childitem -path ./PCF_Projects -include pcfconfig.json -recurse |
Foreach-Object {
echo "::set-output name=exists::True"
echo $_.DirectoryName
}
$solutionPath = $('${{ github.repository }}' -replace '${{ github.repository_owner }}/', '' -replace '[^a-zA-Z]', '')
echo "::set-output name=buildtarget::./Solution"
- name: Use Node.js ${{ matrix.node-version }}
if: steps.checkpcfconfig.outputs.exists == 'True'
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Solution Unique name
if: steps.checkpcfconfig.outputs.exists == 'True'
id: solution-unique-name
uses: mavrosxristoforos/[email protected]
with:
xml-file: "${{ steps.checkpcfconfig.outputs.buildtarget }}/src/Other/Solution.xml"
xpath: "//ImportExportXml/SolutionManifest/UniqueName"
- name: Solution Version
if: steps.checkpcfconfig.outputs.exists == 'True'
id: solution-version
uses: mavrosxristoforos/[email protected]
with:
xml-file: '${{ steps.checkpcfconfig.outputs.buildtarget }}/src/Other/Solution.xml'
xpath: "//ImportExportXml/SolutionManifest/Version"
- name: Caching dependencies
uses: actions/[email protected]
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: ./PCF_Projects/**/**/node_modules/
# An explicit key for restoring and saving the cache
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install dependencies
if: steps.checkpcfconfig.outputs.exists == 'True'
run: |
get-childitem -path ./PCF_Projects -include pcfconfig.json -recurse |
Foreach-Object {
echo $_.DirectoryName
cd $_.DirectoryName
npm install
}
- name: Add msbuild to PATH
uses: microsoft/[email protected]
- name: MSBuild
if: steps.checkpcfconfig.outputs.exists == 'True'
working-directory: ${{ steps.checkpcfconfig.outputs.buildtarget }}
run: |
msbuild /restore /t:rebuild
msbuild /restore /t:rebuild /p:Configuration=Release
- name: Managed Solution Artifact ${{ steps.solution-unique-name.outputs.info }}_${{ steps.solution-version.outputs.info }}_managed.zip
if: steps.checkpcfconfig.outputs.exists == 'True'
uses: actions/upload-artifact@v2
with:
name: ${{ steps.solution-unique-name.outputs.info }}_${{ steps.solution-version.outputs.info }}_managed.zip
path: ${{ steps.checkpcfconfig.outputs.buildtarget }}/bin/Release/${{ steps.solution-unique-name.outputs.info }}.zip
- name: Unmanaged Solution Artifact ${{ steps.solution-unique-name.outputs.info }}_${{ steps.solution-version.outputs.info }}_unmanaged.zip
if: steps.checkpcfconfig.outputs.exists == 'True'
uses: actions/upload-artifact@v2
with:
name: ${{ steps.solution-unique-name.outputs.info }}_${{ steps.solution-version.outputs.info }}_unmanaged.zip
path: ${{ steps.checkpcfconfig.outputs.buildtarget }}/bin/Debug/${{ steps.solution-unique-name.outputs.info }}.zip
- name: Create Release ${{ steps.solution-unique-name.outputs.info }}_v${{ steps.solution-version.outputs.info }}
id: create_release
uses: actions/create-release@v1
if: contains(github.ref, 'refs/tags/v')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ steps.solution-unique-name.outputs.info }}_v${{ steps.solution-version.outputs.info }}
draft: false
prerelease: false
- name: Upload Release Asset ${{ steps.solution-unique-name.outputs.info }}_${{ steps.solution-version.outputs.info }}_managed.zip (Managed)
id: release-managed-solution
uses: actions/upload-release-asset@v1
if: steps.create_release.conclusion == 'success'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.checkpcfconfig.outputs.buildtarget }}/bin/Release/${{ steps.solution-unique-name.outputs.info }}.zip
asset_name: ${{ steps.solution-unique-name.outputs.info }}_${{ steps.solution-version.outputs.info }}_managed.zip
asset_content_type: application/zip
- name: Upload Release Asset ${{ steps.solution-unique-name.outputs.info }}_${{ steps.solution-version.outputs.info }}_unmanaged.zip (Unmanaged)
id: release-unmanaged-solution
uses: actions/upload-release-asset@v1
if: steps.create_release.conclusion == 'success'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.checkpcfconfig.outputs.buildtarget }}/bin/Debug/${{ steps.solution-unique-name.outputs.info }}.zip
asset_name: ${{ steps.solution-unique-name.outputs.info }}_${{ steps.solution-version.outputs.info }}_unmanaged.zip
asset_content_type: application/zip