Merge pull request #187 from KorzhCom/dev #337
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: EasyData.JS Pipeline | |
on: | |
workflow_dispatch: | |
inputs: | |
release_mode: | |
description: 'Release mode (none, dev, prod)' | |
required: true | |
default: 'none' | |
release: | |
types: [published] | |
push: | |
branches: | |
- master | |
paths: | |
- .github/workflows/js-build.yml | |
- easydata.js/** | |
pull_request: | |
branches: | |
- master | |
- dev | |
paths: | |
- .github/workflows/js-build.yml | |
- easydata.js/** | |
jobs: | |
build_and_test: | |
name: Build & Test | |
runs-on: windows-latest | |
defaults: | |
run: | |
working-directory: ./ | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- name: Install dependencies | |
run: npm install | |
- name: Set version | |
run: npm run setver | |
- name: Build | |
run: npm run build | |
- name: Test | |
run: npm test | |
continue-on-error: true | |
- name: Upload packs artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: packs | |
path: | | |
!./easydata.js/packs/**/node_modules/**/*.* | |
./easydata.js/packs/*/dist/**/*.* | |
./easydata.js/packs/*/package.json | |
./easydata.js/packs/*/tsconfig.json | |
./easydata.js/packs/*/*.js | |
./easydata.js/packs/*/*.mjs | |
./easydata.js/packs/*/LICENSE.md | |
./easydata.js/packs/*/README.md | |
- name: Upload Bundles artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: bundles | |
path: | | |
./easydata.js/bundles/**/*.js | |
./easydata.js/bundles/**/*.css | |
release_dev: | |
name: Development Release | |
needs: [ build_and_test ] | |
if: github.event.inputs.release_mode == 'dev' && needs.build_and_test.result == 'success' | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download Bundles artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: bundles | |
path: bundles | |
- name: Read version.json to env | |
uses: antifree/json-to-variables@v1.0.1 | |
with: | |
filename: ./easydata.js/version.json | |
prefix: ed | |
- name: Publish to CDN | |
uses: SamKirkland/FTP-Deploy-Action@v4.3.4 | |
with: | |
server: ${{ secrets.CDN_FTP_SERVER }} | |
username: ${{ secrets.CDN_FTP_USER }} | |
password: ${{ secrets.CDN_FTP_PWD }} | |
local-dir: './bundles/crud/dist/' | |
server-dir: 'cdn.korzh.com/ed/${{ env.ed_baseVersion }}/' | |
- name: Download packs artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: packs | |
path: packs | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
registry-url: 'https://www.myget.org/F/korzh-npm/npm/' | |
- name: Publish @easydata/core | |
run: npm publish ./packs/core | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.MYGET_ACCESS_TOKEN }} | |
- name: Publish @easydata/ui | |
run: npm publish ./packs/ui | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.MYGET_ACCESS_TOKEN }} | |
- name: Publish @easydata/crud | |
run: npm publish ./packs/crud | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.MYGET_ACCESS_TOKEN }} | |
release_prod: | |
name: Production Release | |
needs: [ build_and_test ] | |
if: (github.event.inputs.release_mode == 'prod' || github.event_name == 'release') && needs.build_and_test.result == 'success' | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download bundles artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: bundles | |
path: bundles | |
- name: Read version.json to env | |
uses: antifree/json-to-variables@v1.0.1 | |
with: | |
filename: ./easydata.js/version.json | |
prefix: ed | |
- name: Publish to CDN | |
uses: SamKirkland/FTP-Deploy-Action@v4.3.4 | |
with: | |
server: ${{ secrets.CDN_FTP_SERVER }} | |
username: ${{ secrets.CDN_FTP_USER }} | |
password: ${{ secrets.CDN_FTP_PWD }} | |
local-dir: './bundles/crud/dist/' | |
server-dir: 'cdn.korzh.com/ed/${{ env.ed_baseVersion }}/' | |
- name: Download packs artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: packs | |
path: packs | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
registry-url: 'https://registry.npmjs.org' | |
- name: Publish @easydata/core | |
run: npm publish ./packs/core --access public --tag ${{ env.ed_tag }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} | |
- name: Publish @easydata/ui | |
run: npm publish ./packs/ui --access public --tag ${{ env.ed_tag }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} | |
- name: Publish @easydata/crud | |
run: npm publish ./packs/crud --access public --tag ${{ env.ed_tag }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} |