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/
0 commit comments