Merge pull request #355 from holeng-boxfusion-io/main #411
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
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 "../**/*.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 }} |