diff --git a/.github/workflows/digma-build.yml b/.github/workflows/digma-build.yml new file mode 100644 index 0000000000..1d7df8578b --- /dev/null +++ b/.github/workflows/digma-build.yml @@ -0,0 +1,44 @@ +name: Build + +on: + workflow_call: + outputs: + artifact-name: + value: ${{ jobs.build.outputs.artifact-name }} + version: + value: ${{ jobs.build.outputs.version }} + +jobs: + build: + runs-on: ubuntu-latest + outputs: + artifact-name: ${{ steps.get-artifact-name.outputs.artifact_name }} + version: ${{ steps.get-artifact-name.outputs.version }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + id: setup-node + with: + node-version-file: '.nvmrc' + cache: 'yarn' + + - run: yarn install --frozen-lockfile + + - run: yarn build + + - name: Get artifact name and version + id: get-artifact-name + run: | + git fetch --tags + LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) + echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV + NAME="dist-$LATEST_TAG" + echo "ARTIFACT_NAME=$NAME" >> $GITHUB_ENV + echo "artifact_name=$NAME" >> $GITHUB_OUTPUT + echo "version=${LATEST_TAG#v}" >> $GITHUB_OUTPUT + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ env.ARTIFACT_NAME }} + path: packages/jaeger-ui/build/ diff --git a/.github/workflows/digma/docker-image.yml b/.github/workflows/digma-docker-image.yml similarity index 94% rename from .github/workflows/digma/docker-image.yml rename to .github/workflows/digma-docker-image.yml index 6ba158e74b..accab75181 100644 --- a/.github/workflows/digma/docker-image.yml +++ b/.github/workflows/digma-docker-image.yml @@ -19,9 +19,7 @@ jobs: - uses: actions/download-artifact@v4 with: name: ${{ inputs.dist-artifact-name }} - - run: | - mkdir -p dist - unzip -q ${{ inputs.dist-artifact-name }} -d dist + path: dist - name: Set up QEMU uses: docker/setup-qemu-action@v3 diff --git a/.github/workflows/digma-lint-test.yml b/.github/workflows/digma-lint-test.yml new file mode 100644 index 0000000000..846380705f --- /dev/null +++ b/.github/workflows/digma-lint-test.yml @@ -0,0 +1,23 @@ +name: Lint & test + +on: + workflow_call: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + id: setup-node + with: + node-version-file: '.nvmrc' + cache: 'yarn' + + - run: yarn install --frozen-lockfile + + - name: Lint + run: yarn lint + + - name: Test + run: yarn test diff --git a/.github/workflows/digma/push.yml b/.github/workflows/digma-push.yml similarity index 76% rename from .github/workflows/digma/push.yml rename to .github/workflows/digma-push.yml index 929915a1bf..e07e7b63e8 100644 --- a/.github/workflows/digma/push.yml +++ b/.github/workflows/digma-push.yml @@ -28,18 +28,18 @@ on: jobs: lint-test: name: Lint & test - uses: ./.github/workflows/lint-test.yml + uses: ./.github/workflows/digma-lint-test.yml build: name: Build needs: lint-test - uses: ./.github/workflows/build.yml + uses: ./.github/workflows/digma-build.yml - build-test-docker-image: + build-docker-image: name: Build Docker image needs: build - uses: ./.github/workflows/docker-image.yml + uses: ./.github/workflows/digma-docker-image.yml secrets: inherit with: - dist-artifact-name: ${{ needs.build.outputs.dist-filename }} + dist-artifact-name: ${{ needs.build.outputs.artifact-name }} push: false diff --git a/.github/workflows/digma/release-asset.yml b/.github/workflows/digma-release-asset.yml similarity index 73% rename from .github/workflows/digma/release-asset.yml rename to .github/workflows/digma-release-asset.yml index 2cb2a8657a..ee486f0e19 100644 --- a/.github/workflows/digma/release-asset.yml +++ b/.github/workflows/digma-release-asset.yml @@ -17,9 +17,14 @@ jobs: - uses: actions/download-artifact@v4 with: name: ${{ inputs.artifact-name }} + path: dist + + - run: | + cd dist + zip -r ${{ inputs.artifact-name }}.zip * - uses: softprops/action-gh-release@v2 with: - files: ${{ inputs.artifact-name }} + files: dist/${{ inputs.artifact-name }}.zip env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/digma-release.yml b/.github/workflows/digma-release.yml new file mode 100644 index 0000000000..3e83b25dd8 --- /dev/null +++ b/.github/workflows/digma-release.yml @@ -0,0 +1,57 @@ +name: Lint & test & build & publish Docker image + +on: + workflow_dispatch: + release: + types: [released] + +permissions: + contents: write + +jobs: + lint-test: + name: Lint & test + uses: ./.github/workflows/digma-lint-test.yml + + build: + name: Build + needs: lint-test + uses: ./.github/workflows/digma-build.yml + + attach-release-asset: + name: Attach release asset + needs: build + uses: ./.github/workflows/digma-release-asset.yml + with: + artifact-name: ${{ needs.build.outputs.artifact-name}} + + build-push-docker-image: + name: Build & push Docker image + needs: build + uses: ./.github/workflows/digma-docker-image.yml + secrets: inherit + with: + dist-artifact-name: ${{ needs.build.outputs.artifact-name }} + push: true + + update-digma-ui: + name: Update version in Digma UI + needs: [attach-release-asset, build-push-docker-image] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Get Jaeger version + run: echo "JAEGER_VERSION=$(jq -r '.version' jaeger.json)" >> $GITHUB_ENV + + - name: Create PR in digma-ui + run: | + curl -X POST -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: token ${{ secrets.RELEASE_PAT }}" \ + https://api.github.com/repos/digma-ai/digma-ui/dispatches \ + -d '{ + "event_type": "update-jaeger", + "client_payload": { + "jaegerUIVersion": "'"${{ needs.build.outputs.version }}"'", + "jaegerVersion": "'"${{ env.JAEGER_VERSION }}"'" + } + }' diff --git a/.github/workflows/digma/build.yml b/.github/workflows/digma/build.yml deleted file mode 100644 index 49830f1249..0000000000 --- a/.github/workflows/digma/build.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Build - -on: - workflow_call: - outputs: - dist-filename: - value: ${{ jobs.build.outputs.dist-filename }} - version: - value: ${{ jobs.build.outputs.version }} - -jobs: - build: - runs-on: ubuntu-latest - outputs: - dist-filename: ${{ steps.get-dist-filename.outputs.dist_filename }} - version: ${{ steps.get-dist-filename.outputs.version }} - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - id: setup-node - with: - node-version-file: '.nvmrc' - cache: 'npm' - - - id: node-modules-cache - uses: actions/cache@v4 - with: - path: node_modules - key: ${{ runner.os }}-node-${{ steps.setup-node.outputs.node-version }}-node_modules-${{ hashFiles('yarn.lock') }} - restore-keys: | - ${{ runner.os }}-node-${{ steps.setup-node.outputs.node-version }}-node_modules- - - - if: steps.node-modules-cache.outputs.cache-hit != 'true' - run: yarn install --frozen-lockfile - - - run: yarn build - - - name: Get distributive filename and version - id: get-dist-filename - run: | - git fetch --tags - LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) - echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV - FILENAME="dist-$LATEST_TAG.zip" - echo "DIST_FILENAME=$FILENAME" >> $GITHUB_ENV - echo "dist_filename=$FILENAME" >> $GITHUB_OUTPUT - echo "version=${LATEST_TAG#v}" >> $GITHUB_OUTPUT - - - run: zip -r ${{ env.DIST_FILENAME }} packages/jaeger-ui/build/ - - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: ${{ env.DIST_FILENAME }} - path: ${{ env.DIST_FILENAME }} diff --git a/.github/workflows/digma/lint-test.yml b/.github/workflows/digma/lint-test.yml deleted file mode 100644 index ac5de2b667..0000000000 --- a/.github/workflows/digma/lint-test.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Lint & test - -on: - workflow_call: - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - id: setup-node - with: - node-version-file: '.nvmrc' - cache: 'npm' - - - id: node-modules-cache - uses: actions/cache@v4 - with: - path: node_modules - key: ${{ runner.os }}-node-${{ steps.setup-node.outputs.node-version }}-node_modules-${{ hashFiles('yarn.lock') }} - restore-keys: | - ${{ runner.os }}-node-${{ steps.setup-node.outputs.node-version }}-node_modules- - - - if: steps.node-modules-cache.outputs.cache-hit != 'true' - run: yarn install --frozen-lockfile - - - name: Lint - run: yarn lint - - - name: Test - run: yarn test diff --git a/.github/workflows/digma/release.yml b/.github/workflows/digma/release.yml deleted file mode 100644 index 70ca245ce3..0000000000 --- a/.github/workflows/digma/release.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Lint & test & build & publish Docker image - -on: - workflow_dispatch: - release: - types: [released] - -permissions: - contents: write - -jobs: - lint-test: - name: Lint & test - uses: ./.github/workflows/lint-test.yml - - build: - name: Build - needs: lint-test - uses: ./.github/workflows/build.yml - - attach-dist-asset: - name: Attach release asset - needs: build - uses: ./.github/workflows/release-asset.yml - with: - artifact-name: ${{ needs.build.outputs.dist-filename }} - - build-push-docker-image: - name: Build & push Docker image - needs: build - uses: ./.github/workflows/docker-image.yml - secrets: inherit - with: - dist-artifact-name: ${{ needs.build.outputs.dist-filename }} - push: true - - update-digma-ui: - needs: [attach-dist-asset, build-push-docker-image] - name: Update version in Digma UI - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Get Jaeger version - run: echo "JAEGER_VERSION=$(jq -r '.version' jaeger.json)" >> $GITHUB_ENV - - - name: Get dist artifact version name - id: get-dist-filename - run: echo "dist-filename=$(cat ${{ needs.build.outputs.dist-filename }})" >> $GITHUB_ENV - - - run: | - curl -X POST -H "Accept: application/vnd.github.v3+json" \ - -H "Authorization: token ${{ secrets.PAT }}" \ - https://api.github.com/repos/digma-ai/digma-ui/dispatches \ - -d '{ - "event_type":"update-jaeger", - "client_payload": { - "jaegerUIVersion": "'"${{ needs.build.outputs.version }}"'", - "jaegerVersion": "'"${{ env.JAEGER_VERSION }}"'" - } - }'