diff --git a/.github/workflows/build_resuable.yaml b/.github/workflows/build_resuable.yaml new file mode 100644 index 00000000..f5f20f65 --- /dev/null +++ b/.github/workflows/build_resuable.yaml @@ -0,0 +1,33 @@ +name: Build resuable +on: + workflow_call: + +jobs: + build_resuable: + name: Build Element Call + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Yarn cache + uses: actions/setup-node@v4 + with: + cache: "yarn" + - name: Install dependencies + run: "yarn install" + - name: Build + run: "yarn run build" + env: + SENTRY_ORG: ${{ secrets.SENTRY_ORG }} + SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} + SENTRY_URL: ${{ secrets.SENTRY_URL }} + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + VITE_APP_VERSION: ${{ github.sha }} + NODE_OPTIONS: "--max-old-space-size=4096" + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: build + path: dist + # We'll only use this in a triggered job, then we're done with it + retention-days: 1 \ No newline at end of file diff --git a/.github/workflows/docker-pr.yaml b/.github/workflows/docker-pr.yaml index 97d5857f..8ce15d67 100644 --- a/.github/workflows/docker-pr.yaml +++ b/.github/workflows/docker-pr.yaml @@ -1,21 +1,23 @@ name: Docker PR Preview on: - workflow_run: - workflows: ["Build"] + pull_request: types: - - completed - branches-ignore: - - "main" - - "livekit" + - synchronize + - opened + - labeled env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} jobs: + build_element_call: + if: ${{ contains(github.event.pull_request.labels.*.name, 'docker build') }} + uses: ./.github/workflows/build_resuable.yaml + build_docker: - if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'docker build') }} + if: ${{ contains(github.event.pull_request.labels.*.name, 'docker build') }} runs-on: ubuntu-latest permissions: deployments: write @@ -42,7 +44,7 @@ jobs: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | type=sha,format=short,event=branch - type=raw,value=lpr_${{ github.event.pull_request.number }} + type=raw,value=pr_${{ github.event.workflow_run.pull_requests[0].number }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb @@ -54,4 +56,4 @@ jobs: platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file