Merge pull request #248 from SNT01/release-8.0.1 #4
Workflow file for this run
This file contains hidden or 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: Build and Upload Content Editor | |
| on: | |
| push: | |
| tags: | |
| - '*' | |
| jobs: | |
| build-and-upload: | |
| runs-on: ubuntu-latest | |
| env: | |
| NODE_VERSION: 10.24.1 | |
| CHROME_BIN: google-chrome | |
| editorType: contentEditor | |
| framework_version_number: ${{ github.ref_name }} | |
| editor_version_number: ${{ github.ref_name }} | |
| build_number: ${{ github.sha }} | |
| CLOUD_PROVIDER: ${{ vars.CLOUD_PROVIDER }} | |
| GCP_BUCKET: ${{ vars.GCP_BUCKET }} | |
| AZURE_CONTAINER: ${{ vars.AZURE_CONTAINER }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential libpng-dev google-chrome-stable | |
| - name: Cache node modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: node_modules | |
| key: ${{ runner.os }}-node-${{ hashFiles('package.json') }} | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Install global npm tools | |
| run: npm install -g [email protected] [email protected] | |
| - name: Clone sunbird-content-plugins | |
| run: git clone https://github.com/project-sunbird/sunbird-content-plugins.git plugins -b ${{ github.ref_name }} | |
| - name: Clean npm cache and install dependencies | |
| run: | | |
| npm cache clean --force | |
| npm install | |
| - name: Install bower dependencies | |
| working-directory: app | |
| run: | | |
| bower cache clean --allow-root | |
| bower prune -f --allow-root | |
| bower install --force -V --allow-root | |
| - name: Build main project | |
| run: | | |
| npm install gulp-gzip --save-dev | |
| npm run build-npm-pkg | |
| - name: Setup Google Cloud SDK | |
| if: env.CLOUD_PROVIDER == 'gcp' | |
| uses: google-github-actions/setup-gcloud@v1 | |
| with: | |
| install_components: 'gsutil' | |
| - name: Authenticate and Upload to Google Cloud Storage | |
| if: env.CLOUD_PROVIDER == 'gcp' | |
| run: | | |
| umask 077 | |
| echo "${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}" | base64 -d > /tmp/service-account-key.json | |
| gcloud auth activate-service-account --key-file=/tmp/service-account-key.json | |
| gsutil -m cp -r content-editor/* gs://${{ env.GCP_BUCKET }}/content-editor/ | |
| rm -f /tmp/service-account-key.json | |
| - name: Upload to Azure Blob Storage | |
| if: env.CLOUD_PROVIDER == 'azure' | |
| uses: azure/CLI@v2 | |
| with: | |
| azcliversion: latest | |
| inlineScript: | | |
| az storage blob upload-batch \ | |
| --account-name "${{ secrets.AZURE_STORAGE_ACCOUNT }}" \ | |
| --account-key "${{ secrets.AZURE_STORAGE_KEY }}" \ | |
| --destination "${{ vars.AZURE_CONTAINER }}/content-editor" \ | |
| --source content-editor \ | |
| --overwrite | |
| # Note: Publish to AWS S3 is not tested | |
| # - name: Configure AWS credentials | |
| # if: env.CLOUD_PROVIDER == 'aws' | |
| # uses: aws-actions/configure-aws-credentials@v4 | |
| # with: | |
| # aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| # aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| # aws-region: ${{ vars.AWS_REGION || 'us-east-1' }} | |
| # - name: Upload to Amazon S3 | |
| # if: env.CLOUD_PROVIDER == 'aws' | |
| # env: | |
| # S3_BUCKET: ${{ vars.S3_BUCKET }} | |
| # run: | | |
| # aws s3 sync content-editor s3://${{ env.S3_BUCKET }}/content-editor/ |