Merge pull request #49 from SoftwareAG/feature/device-property-implem… #43
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: Widget - CD | |
on: | |
workflow_dispatch: | |
inputs: | |
tenant_url: | |
required: true | |
description: "Tenant URL" | |
type: string | |
push: | |
paths: | |
- asset-properties-widget/** | |
branches: | |
- develop | |
env: | |
APP_CONTEXT_PATH: "sag-pkg-asset-properties-widget" | |
jobs: | |
build-widget: | |
uses: ./.github/workflows/build-widget.yml | |
with: | |
build_command: "yarn build" | |
app_file_name_prefix: "sag-pkg-asset-properties-widget" | |
app_context_path: "sag-pkg-asset-properties-widget" | |
upload_artifact: true | |
deploy: | |
runs-on: [ubuntu-latest] | |
needs: [build-widget] | |
steps: | |
- name: Determine target tenant | |
id: determine-target-tenant | |
run: | | |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
echo "tenantUrl=${{ github.event.inputs.tenant_url }}" >> $GITHUB_OUTPUT | |
elif [[ "${{ github.event_name }}" != "workflow_dispatch" ]]; then | |
echo "tenantUrl=${{ secrets.TENANT_URL }}" >> $GITHUB_OUTPUT | |
fi | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Create folder | |
run: | | |
if [[ ! -d "downloads" ]]; then | |
mkdir downloads | |
fi | |
- name: Compose file name | |
id: compose-file-name | |
run: | | |
version=`jq -r '.version' package.json` | |
echo "app_file_name=${{env.APP_CONTEXT_PATH}}-$version" >> $GITHUB_OUTPUT | |
- name: Download webapp | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ steps.compose-file-name.outputs.app_file_name }} | |
path: "./downloads" | |
- name: Deploy webapp | |
uses: ./.github/actions/c8y-deploy-action | |
with: | |
TYPE: HOSTED | |
PACKAGE_LOCATION: ${{ github.workspace }}/downloads/${{ steps.compose-file-name.outputs.app_file_name }}.zip | |
TENANT_URL: ${{ steps.determine-target-tenant.outputs.tenantUrl }} | |
AUTHORIZATION_CODE: ${{ secrets.AUTHORIZATION_CODE }} | |
APPLICATION_NAME: "Asset properties widget" | |
CONTEXT_PATH: ${{env.APP_CONTEXT_PATH}} | |
DELETE_EXISTING: false | |
e2e-tests: | |
needs: [deploy] | |
uses: ./.github/workflows/cypress-test.yml | |
with: | |
tenantUrl: ${{ github.event.inputs.tenant_url }} | |
project_directory: cypress-E2E-tests | |
spec_files: "cypress/integration/**/*" | |
browser: "chrome" | |
secrets: | |
AUTOTEST_USERNAME1: ${{ secrets.AUTOTEST_USERNAME1 }} | |
AUTOTEST_USERNAME1_PASSWORD: ${{ secrets.AUTOTEST_USERNAME1_PASSWORD }} | |
AUTOTEST_USERNAME2: ${{ secrets.AUTOTEST_USERNAME2 }} | |
AUTOTEST_USERNAME2_PASSWORD: ${{ secrets.AUTOTEST_USERNAME2_PASSWORD }} | |
TENANT_URL: ${{ secrets.TENANT_URL }} |