Skip to content

Commit

Permalink
Fix CI (#63)
Browse files Browse the repository at this point in the history
* Move all workflows to the same folder level

* Exclude zip extension from the artifact filename
  • Loading branch information
kshmidt-digma authored Dec 12, 2024
1 parent 1227c5e commit 4b8a044
Show file tree
Hide file tree
Showing 9 changed files with 136 additions and 156 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/digma-build.yml
Original file line number Diff line number Diff line change
@@ -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/
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/digma-lint-test.yml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
57 changes: 57 additions & 0 deletions .github/workflows/digma-release.yml
Original file line number Diff line number Diff line change
@@ -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 }}"'"
}
}'
55 changes: 0 additions & 55 deletions .github/workflows/digma/build.yml

This file was deleted.

32 changes: 0 additions & 32 deletions .github/workflows/digma/lint-test.yml

This file was deleted.

60 changes: 0 additions & 60 deletions .github/workflows/digma/release.yml

This file was deleted.

0 comments on commit 4b8a044

Please sign in to comment.