-
Notifications
You must be signed in to change notification settings - Fork 64
130 lines (111 loc) · 4.09 KB
/
publish-shesha-4.x.x.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
119
120
121
122
123
124
125
126
127
128
129
130
name: shesha-4.x.x
# This workflow is designed to build the shesha-core and shesha-reactjs applications
# and then publish them to their respective repositories i.e. nuget and npmjs
on:
push:
branches:
- main
paths:
- shesha-reactjs/**
- shesha-core/**
# pull_request:
# types:
# - closed
# branches:
# - main
# paths:
# - shesha-reactjs/**
# - shesha-core/**
env:
NODE_VERSION: "18"
#PYTHON_VERSOIN: '2.7.18'
DOTNET_VERSION: "7.x"
jobs:
# build the project
build:
permissions: write-all
runs-on: ubuntu-latest
steps:
# checkout latest code
- name: Get Sources
uses: actions/checkout@v2
with:
clean: true
ref: main
# ============ TAG BRANCH ===============
# Create Tag
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag_prefix: ""
# ============ SETUP ENVIRONMENTS ===============
# Setup Node for shesha-reactjs
- name: Setup Node ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: "https://registry.npmjs.org"
# Setup Python for for shesha-reactjs (solution currently needs python2 to run)
#- uses: actions/setup-python@v4
# with:
# python-version: ${{ env.PYTHON_VERSOIN }}
# Setup DOTNET for shesha-core
- name: Use .NET Core SDK ${{ env.DOTNET_VERSION }}
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
# ============ RESOLVE DEPENDENCIES ===============
# DOTNET restore for shesha-core
- name: Dotnet Restore
run: dotnet restore --configfile .nuget/NuGet.Config --verbosity detailed
working-directory: ./shesha-core
# Install dependencies for shesha-reactjs
- name: Install Dependencies
run: npm install
working-directory: ./shesha-reactjs
# ============ PREPARE ===============
# Prepare shesha-reactjs for pipeline
- name: Prepare shesha-reactjs for Pipeline
run: npm run prepare
working-directory: ./shesha-reactjs
# ============ METADATA ===============
# Update package.json tag
- name: Update package.json
uses: reedyuk/[email protected]
with:
version: ${{ steps.tag_version.outputs.new_tag }}
package: "shesha-reactjs/"
# ============ BUILD ===============
# Build shesha-core (Solution) for production
- name: Dotnet Build
run: dotnet build --configuration Release
working-directory: ./shesha-core
# Build shesha-reactjs for production
- name: Build shesha-reactjs for Production
run: npm run build
working-directory: ./shesha-reactjs
# ============ PACK ===============
# Pack shesha-core (Solution)
- name: Dotnet Pack shesha-core
run: dotnet pack -o ../dist -p:PackageVersion=${{ steps.tag_version.outputs.new_tag }} -p:Version=${{ steps.tag_version.outputs.new_tag }} --include-symbols --include-source
working-directory: ./shesha-core
# ============ RELEASE ===============
# create github release
- name: Create Github Release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: shesha-reactjs@${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
# push nuget packages
- name: Dotnet Nuget Push
run: dotnet nuget push "../dist/*.nupkg" --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate
working-directory: ./shesha-core
# publish shesha-reactjs to npmjs registry
- name: Publish shesha-reactjs to npmjs registry
run: npm publish --access public
working-directory: ./shesha-reactjs
env:
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_API_KEY }}