Skip to content

Bump @c8y/cli from 1018.0.143 to 1018.0.147 in /frontend #189

Bump @c8y/cli from 1018.0.143 to 1018.0.147 in /frontend

Bump @c8y/cli from 1018.0.143 to 1018.0.147 in /frontend #189

Workflow file for this run

# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
pull_request:
branches: [main]
name: Main CI
env:
NODE_VERSION: '14'
jobs:
build:
name: 🚧 Lint, Test, Build & (optionally) Release
runs-on: ubuntu-latest
steps:
- name: Set RELEASE_VERSION env variable
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Check out Git repository
uses: actions/checkout@v3
- name: Mark backend version as SNAPSHOT
if: github.event_name != 'push' || !startsWith(github.ref, 'refs/tags/v')
run: |
cd backend
sed -i '/\"version\"/s/\"\,/\-SNAPSHOT\"\,/g' cumulocity.json
- name: Set up Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Set C8Y_VERSION env variable
run: echo "C8Y_VERSION=$(node -p -e "require('./frontend/package.json').dependencies['@c8y/ngx-components']")" >> $GITHUB_ENV
- name: Cache node modules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install Node.js dependencies
run: |
cd frontend
npm ci
- name: 🕵️‍♂️ Lint
run: |
cd frontend
npm run lint --if-present
- name: 🧪 Test
run: |
cd frontend
npm test --if-present
- name: 🚧 Build Frontend
run: |
cd frontend
npm run build:ci
- name: Upload Frontend Artifact
uses: actions/upload-artifact@v3
with:
name: node-red-ui-${{ env.C8Y_VERSION }}-${{ github.event.number }}-${{ github.run_id }}
if-no-files-found: error
retention-days: 5
path: frontend/dist/apps/sag-ps-iot-pkg-node-red-ui/
- name: 🚧 Build Backend
run: |
cd backend
docker build -t node-red-ms .
docker save node-red-ms -o image.tar
- name: Upload Backend Artifact
uses: actions/upload-artifact@v3
with:
name: node-red-${{ env.C8Y_VERSION }}-${{ github.event.number }}-${{ github.run_id }}
if-no-files-found: error
retention-days: 5
path: |
backend/cumulocity.json
backend/image.tar
- name: 🎁 Zip Frontend
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
run: |
cd frontend/dist/apps/sag-ps-iot-pkg-node-red-ui
zip -r -q ../../../node-red-ui.zip *
- name: 🎁 Zip Backend
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
run: |
cd backend
zip --junk-paths node-red cumulocity.json image.tar
- name: Create Release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ env.RELEASE_VERSION }} based on ${{ env.C8Y_VERSION }}
draft: false
prerelease: false
- name: Upload Release Asset Frontend
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
id: upload-release-asset-frontend
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./frontend/node-red-ui.zip
asset_name: node-red-ui-${{ env.C8Y_VERSION }}-${{ env.RELEASE_VERSION }}.zip
asset_content_type: application/zip
- name: Upload Release Asset Backend
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
id: upload-release-asset-backend
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./backend/node-red.zip
asset_name: node-red.zip
asset_content_type: application/zip