Skip to content

Commit b1bc344

Browse files
Merge pull request #89 from JeraldJF/cghanges
SBCOSS-I299: generic editor build workflow
2 parents 5dc00bf + 93afd66 commit b1bc344

File tree

5 files changed

+111
-71
lines changed

5 files changed

+111
-71
lines changed

.circleci/config.yml

Lines changed: 0 additions & 70 deletions
This file was deleted.
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: Publish Sunbird-generic-editor to blob
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
env:
9+
NODE_VERSION: 10.24.1
10+
version_number: ${{ github.ref_name }}
11+
build_number: ${{ github.run_number }}
12+
CLOUD_PROVIDER: ${{ vars.CLOUD_PROVIDER }}
13+
GCP_BUCKET: ${{ vars.GCP_BUCKET }}
14+
AZURE_CONTAINER: ${{ vars.AZURE_CONTAINER }}
15+
16+
jobs:
17+
publish:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Cache node modules
25+
uses: actions/cache@v3
26+
with:
27+
path: node_modules
28+
key: ${{ runner.os }}-node-${{ hashFiles('package.json') }}
29+
30+
- name: Setup Node.js
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: ${{ env.NODE_VERSION }}
34+
registry-url: 'https://registry.npmjs.org/'
35+
36+
- name: Install system dependencies
37+
run: |
38+
sudo apt-get update
39+
sudo apt-get install -y build-essential libpng-dev
40+
41+
- name: Clone content plugins
42+
run: |
43+
git clone https://github.com/project-sunbird/sunbird-content-plugins.git plugins -b ${{ github.ref_name }}
44+
45+
- name: Install global dependencies
46+
run: |
47+
npm install -g bower@1.8.0 grunt-cli@1.2.0 gulp@3.9.1
48+
49+
- name: Install dependencies
50+
run: npm install --legacy-peer-deps
51+
env:
52+
PHANTOMJS_PLATFORM: linux
53+
PHANTOMJS_ARCH: x64
54+
TMPDIR: /tmp
55+
56+
- name: Install bower dependencies
57+
working-directory: app
58+
run: |
59+
bower cache clean --allow-root
60+
bower install --force --allow-root
61+
62+
- name: Build and package
63+
run: |
64+
npm run build-npm-pkg
65+
66+
- name: Setup Google Cloud SDK
67+
if: env.CLOUD_PROVIDER == 'gcp'
68+
uses: google-github-actions/setup-gcloud@v1
69+
with:
70+
install_components: 'gsutil'
71+
72+
- name: Authenticate and Upload to Google Cloud Storage
73+
if: env.CLOUD_PROVIDER == 'gcp'
74+
run: |
75+
echo "${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}" | base64 -d > /tmp/service-account-key.json
76+
gcloud auth activate-service-account --key-file=/tmp/service-account-key.json
77+
gsutil -m cp -r generic-editor/* gs://${{ env.GCP_BUCKET }}/generic-editor/
78+
rm -f /tmp/service-account-key.json
79+
80+
- name: Upload to Azure Blob Storage
81+
if: env.CLOUD_PROVIDER == 'azure'
82+
uses: azure/CLI@v1
83+
with:
84+
azcliversion: latest
85+
inlineScript: |
86+
az storage blob upload-batch \
87+
--account-name "${{ secrets.AZURE_STORAGE_ACCOUNT }}" \
88+
--account-key "${{ secrets.AZURE_STORAGE_KEY }}" \
89+
--destination "${{ vars.AZURE_CONTAINER }}/generic-editor" \
90+
--source generic-editor \
91+
--overwrite
92+
93+
# Note: Publishing to AWS S3 is not tested.
94+
95+
# - name: Configure AWS credentials
96+
# if: env.CLOUD_PROVIDER == 'aws'
97+
# uses: aws-actions/configure-aws-credentials@v4
98+
# with:
99+
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
100+
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
101+
# aws-region: ${{ vars.AWS_REGION || 'us-east-1' }}
102+
103+
# - name: Upload to Amazon S3
104+
# if: env.CLOUD_PROVIDER == 'aws'
105+
# env:
106+
# S3_BUCKET: ${{ vars.S3_BUCKET }}
107+
# run: |
108+
# aws s3 sync generic-editor s3://${{ env.S3_BUCKET }}/generic-editor/

app/bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"oclazyload": "^1.0.9",
2020
"ngSafeApply": "./libs/Scope.SafeApply.js",
2121
"izitoast": "^1.1.3",
22-
"contenteditor": "https://sunbirdstagingpublic.blob.core.windows.net/sunbird-content-staging-knowlg/content-editor/scripts/base-editor.min.js"
22+
"contenteditor": "https://raw.githubusercontent.com/Sunbird-Knowlg/sunbird-generic-editor/refs/heads/release-8.1.0/base-editor.min.js"
2323
},
2424
"appPath": "app",
2525
"moduleName": "editorApp",

base-editor.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"gulp-concat": "^2.6.1",
5252
"gulp-filter": "^4.0.0",
5353
"gulp-git": "^2.8.0",
54+
"gulp-gzip": "^1.4.2",
5455
"gulp-inject": "^4.2.0",
5556
"gulp-main-bower-files": "^1.6.0",
5657
"gulp-minifier": "^0.1.4",

0 commit comments

Comments
 (0)