Added Demo Web Application #6
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: Deploy React WebApps | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| - devOps/CI_CD | |
| paths: | |
| - "examples/web_apps/Framework_Examples/**" | |
| - ".github/workflows/webapp_deploy.yml" | |
| pull_request: | |
| branches: | |
| - main | |
| - master | |
| paths: | |
| - "examples/web_apps/Framework_Examples/**" | |
| - ".github/workflows/deploy.yml" | |
| jobs: | |
| build-package-deploy: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: # Add frameworks and Folder names here | |
| include: | |
| - framework: React | |
| app-folder: ApiKeyAuthApp | |
| # - framework: Angular | |
| # app-folder: my-angular-app-1 # example entry | |
| env: | |
| NODE_VERSION: "24.x.x" | |
| REACT_APPS_DIR: examples/web_apps/Framework_Examples/React | |
| ANGULAR_APPS_DIR: examples/web_apps/Framework_Examples/Angular | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Set App Directory | |
| run: | | |
| if [ "${{ matrix.framework }}" == "React" ]; then | |
| echo "APP_DIR=${{ env.REACT_APPS_DIR }}/${{ matrix.app-folder }}" >> $GITHUB_ENV | |
| else | |
| echo "APP_DIR=${{ env.ANGULAR_APPS_DIR }}/${{ matrix.app-folder }}" >> $GITHUB_ENV | |
| fi | |
| - name: Install dependencies | |
| working-directory: ${{ env.APP_DIR }} | |
| run: npm ci | |
| - name: Lint | |
| working-directory: ${{ env.APP_DIR }} | |
| run: npm run lint | |
| - name: Build | |
| working-directory: ${{ env.APP_DIR }} | |
| run: npm run build | |
| - name: Setup Homebrew + Install slcli | |
| run: | | |
| eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" | |
| brew tap ni-kismet/homebrew-ni | |
| brew install slcli | |
| echo "/home/linuxbrew/.linuxbrew/bin" >> $GITHUB_PATH | |
| - name: Package into .nipkg | |
| working-directory: ${{ env.APP_DIR }} | |
| run: | | |
| WEBAPP_NAME=$(basename "$PWD") | |
| slcli webapp pack dist/ --output "${WEBAPP_NAME}.nipkg" | |
| echo "WEBAPP_NAME=${WEBAPP_NAME}" >> $GITHUB_ENV | |
| - name: Upload .nipkg artifact to gitHub | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: ${{ matrix.app-folder }}.nipkg | |
| path: ${{env.REACT_APPS_DIR}}/${{matrix.app-folder}}/${{env.WEBAPP_NAME}}.nipkg | |
| - name: Login to SystemLink | |
| run: | | |
| slcli login --profile ghActions --url "${{ secrets.SL_API_URL }}" --api-key "${{ secrets.SL_API_KEY }}" --web-url "${{ secrets.SL_WEBSITE_URL }}" --workspace "${{secrets.SL_WORKSPACE}}" | |
| - name: Deploy (publish new/update) webapp (nipkg) to SystemLink Website | |
| working-directory: ${{ env.APP_DIR }} | |
| run: | | |
| pkg=${{env.WEBAPP_NAME}}.nipkg | |
| WEBAPP_NAME="$(basename "$pkg" .nipkg)_PROD" | |
| echo "**Deploying "$pkg" "$WEBAPP_NAME"**" | |
| WEBAPP_ID=$(slcli webapp list --workspace "${{ secrets.SL_WORKSPACE }}" --filter "$WEBAPP_NAME" --format json | jq -r '.[0].id // empty') | |
| if [[ -z "$WEBAPP_ID" ]]; then | |
| echo " *Webapp does not exist -- publishing new" | |
| slcli webapp publish "$pkg" --name "$WEBAPP_NAME" --workspace "${{ secrets.SL_WORKSPACE }}" | |
| else | |
| echo " *Webapp exists -- updating" | |
| slcli webapp publish "$pkg" --id "$WEBAPP_ID" | |
| fi | |
| echo "**Deployed "$WEBAPP_NAME"**" |