-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (84 loc) · 3.53 KB
/
create-package-artifact.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
name: Create package artificat of a deployment
on:
push:
branches:
- develop
env:
PROJECT_PATH: 'Pipeline.csproj'
PACKAGE_OUTPUT_DIRECTORY: ${{ github.workspace }}\output
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: 🛎 Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 🚧 Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- name: ⚙️ Get previous tag.
id: version
run: |
lastTag=`git tag -l --sort=-creatordate --format='%(refname:short)' | head -n 1`
echo "::set-output name=tag::$lastTag"
- name: ⚙️ Bump if alpha.
id: bump-with-alpha
uses: actions/github-script@v3
with:
result-encoding: string
script: |
const incoming = "${{steps.version.outputs.tag}}"
console.log("Incoming Tag: " + incoming)
if(incoming.includes('alpha')) {
const oldNum = incoming.match(/alpha[.]*(\d+)/)[1]
const newNum = parseInt(oldNum)+1
const newTag = incoming.replace(/alpha.*\d+/, `alpha.${newNum}`)
console.log("New Tag: " + newTag)
return newTag
}
else {
const newTag =incoming +'-alpha.0'
console.log("New Tag: " + newTag)
return newTag
}
- name: 🔧 Restore nuget with dotnet
run: dotnet restore ${{ env.PROJECT_PATH }}
- name: 🧱 Build project
run: dotnet build ${{ env.PROJECT_PATH }} --no-restore --configuration Release -p:Version=${{ steps.bump-with-alpha.outputs.result }} --output ${{ env.PACKAGE_OUTPUT_DIRECTORY }}
- name: Create text file
run: |-
cat <<EOT >> installation.txt
### For Grasshopper
Copy the MMLibGh folder into the local folder:
C:\Users\"your username"\AppData\Roaming\Grasshopper\Libraries
### For Dynamo in Revit
Copy the MMLibDyn folder into the local folder:
C:\Users\{USER}\AppData\Roaming\Dynamo\Dynamo {TARGET}\{VERSION}\pakages
### For Dynamo in Civil3D
Copy the MMLibDyn folder into the local folder:
C:\Users\{USER}\AppData\Autodesk\C3D {VERSION}\Dynamo\{VERSION}\pakages
- name: 📘 Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.bump-with-alpha.outputs.result }}
release_name: ${{ steps.bump-with-alpha.outputs.result }}
body: |
## Title
## Body
draft: false
prerelease: false
- name: 💾 7Zip library
run: 7z a -t7z -mx=9 PipelineLib-${{ steps.bump-with-alpha.outputs.result }}.7z ${{ env.PACKAGE_OUTPUT_DIRECTORY }} ./images installation.txt
- name: 📤 Upload library to release
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.bump-with-alpha.outputs.result }}
file: PipelineLib-${{ steps.bump-with-alpha.outputs.result }}.7z
asset_name: PipelineLib-${{ steps.bump-with-alpha.outputs.result }}.7z
overwrite: true