ED-4000 feat: Github actions instead of Jenkins-18 #18
Workflow file for this run
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: Build and Deploy | |
on: | |
push: | |
branches: | |
- "*" # Trigger on push to any branch | |
pull_request: | |
branches: | |
- "*" # Trigger on pull request to any branch | |
jobs: | |
build_and_deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "18" | |
- name: Customize dependencies | |
if: ${{ env.WL_Customization != null }} | |
run: | | |
git clone --recurse-submodules ${WL_Customization} sunbirded-portal | |
cp -r sunbirded-portal/images/ src/app/client/src/assets | |
cp -r sunbirded-portal/resourceBundles/data/ src/app/resourcebundles/ | |
- name: Build | |
run: | | |
commit_hash=$(git rev-parse --short HEAD) | |
build_tag=$(echo "${{ github.ref }}" | rev | cut -d/ -f1 | rev)_${commit_hash}_${GITHUB_RUN_NUMBER} | |
echo "build_tag: $build_tag" | |
bash ./build.sh "${build_tag}" "${{ env.NODE_NAME }}" "test" true false "" | |
env: | |
NODE_NAME: "18.20.2" | |
- name: Archive Artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: metadata | |
path: metadata.json | |
- name: Archive CDN assets if required | |
if: ${{ github.event.inputs.buildCdnAssests == 'true' }} | |
run: | | |
rm -rf cdn_assets | |
mkdir cdn_assets | |
cp -r src/app/dist-cdn/* cdn_assets/ | |
zip -Jr cdn_assets.zip cdn_assets | |
echo "##vso[task.uploadfile]cdn_assets.zip" | |
env: | |
WL_Customization: ${{ github.event.inputs.WL_Customization }} |