refactor: Update workflow triggers for E2E tests and deployment processes
This commit is contained in:
@@ -2,15 +2,13 @@ name: Build and Push Docker Image
|
|||||||
on:
|
on:
|
||||||
workflow_run:
|
workflow_run:
|
||||||
workflows:
|
workflows:
|
||||||
- Run Tests
|
- Run E2E Tests
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
types:
|
types:
|
||||||
- completed
|
- completed
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build-and-push:
|
||||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
if: ${{ github.event_name != 'workflow_run' || (github.event.workflow_run.conclusion == 'success' && (github.event.workflow_run.head_branch == 'main' || github.event.workflow_run.head_branch == 'refs/heads/main')) }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
DEFAULT_BRANCH: main
|
DEFAULT_BRANCH: main
|
||||||
@@ -41,6 +39,10 @@ jobs:
|
|||||||
sha="${WORKFLOW_RUN_HEAD_SHA}"
|
sha="${WORKFLOW_RUN_HEAD_SHA}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "$ref_name" == refs/heads/* ]]; then
|
||||||
|
ref_name="${ref_name#refs/heads/}"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$ref_name" = "${DEFAULT_BRANCH:-main}" ]; then
|
if [ "$ref_name" = "${DEFAULT_BRANCH:-main}" ]; then
|
||||||
echo "on_default=true" >> "$GITHUB_OUTPUT"
|
echo "on_default=true" >> "$GITHUB_OUTPUT"
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -3,14 +3,12 @@ on:
|
|||||||
workflow_run:
|
workflow_run:
|
||||||
workflows:
|
workflows:
|
||||||
- Build and Push Docker Image
|
- Build and Push Docker Image
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
types:
|
types:
|
||||||
- completed
|
- completed
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
if: ${{ github.event_name != 'workflow_run' || (github.event.workflow_run.conclusion == 'success' && (github.event.workflow_run.head_branch == 'main' || github.event.workflow_run.head_branch == 'refs/heads/main')) }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
DEFAULT_BRANCH: main
|
DEFAULT_BRANCH: main
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
name: Run E2E Tests
|
name: Run E2E Tests
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
workflow_run:
|
||||||
branches:
|
workflows:
|
||||||
- '**'
|
- Run Tests
|
||||||
pull_request:
|
types:
|
||||||
branches:
|
- completed
|
||||||
- main
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
e2e:
|
e2e:
|
||||||
name: E2E Tests
|
name: E2E Tests
|
||||||
|
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' && (github.event.workflow_run.head_branch == 'main' || github.event.workflow_run.head_branch == 'refs/heads/main')) }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: mcr.microsoft.com/playwright/python:v1.55.0-jammy
|
container: mcr.microsoft.com/playwright/python:v1.55.0-jammy
|
||||||
env:
|
env:
|
||||||
|
|||||||
Reference in New Issue
Block a user