Merge pull request 'fix: Enhance workflow conditions for E2E tests and deployment processes' (#7) from fest/ci-improvement into main
Reviewed-on: #7
This commit is contained in:
@@ -8,7 +8,19 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build-and-push:
|
||||||
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')) }}
|
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' ||
|
||||||
|
(
|
||||||
|
!github.event.workflow_run.head_branch && (
|
||||||
|
github.event.workflow_run.repository.default_branch == 'main' ||
|
||||||
|
github.event.workflow_run.repository.default_branch == 'refs/heads/main' ||
|
||||||
|
github.event.repository.default_branch == 'main' ||
|
||||||
|
github.event.repository.default_branch == 'refs/heads/main'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
) }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
DEFAULT_BRANCH: main
|
DEFAULT_BRANCH: main
|
||||||
@@ -19,6 +31,8 @@ jobs:
|
|||||||
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
WORKFLOW_RUN_HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}
|
WORKFLOW_RUN_HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}
|
||||||
WORKFLOW_RUN_HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
|
WORKFLOW_RUN_HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
|
||||||
|
WORKFLOW_RUN_REPO_DEFAULT_BRANCH: ${{ github.event.workflow_run.repository.default_branch }}
|
||||||
|
REPOSITORY_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -35,6 +49,14 @@ jobs:
|
|||||||
ref_name="${WORKFLOW_RUN_HEAD_BRANCH}"
|
ref_name="${WORKFLOW_RUN_HEAD_BRANCH}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "$ref_name" ] && [ -n "${WORKFLOW_RUN_REPO_DEFAULT_BRANCH:-}" ]; then
|
||||||
|
ref_name="${WORKFLOW_RUN_REPO_DEFAULT_BRANCH}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$ref_name" ] && [ -n "${REPOSITORY_DEFAULT_BRANCH:-}" ]; then
|
||||||
|
ref_name="${REPOSITORY_DEFAULT_BRANCH}"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$sha" ] && [ -n "${WORKFLOW_RUN_HEAD_SHA:-}" ]; then
|
if [ -z "$sha" ] && [ -n "${WORKFLOW_RUN_HEAD_SHA:-}" ]; then
|
||||||
sha="${WORKFLOW_RUN_HEAD_SHA}"
|
sha="${WORKFLOW_RUN_HEAD_SHA}"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -8,7 +8,19 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
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')) }}
|
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' ||
|
||||||
|
(
|
||||||
|
!github.event.workflow_run.head_branch && (
|
||||||
|
github.event.workflow_run.repository.default_branch == 'main' ||
|
||||||
|
github.event.workflow_run.repository.default_branch == 'refs/heads/main' ||
|
||||||
|
github.event.repository.default_branch == 'main' ||
|
||||||
|
github.event.repository.default_branch == 'refs/heads/main'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
) }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
DEFAULT_BRANCH: main
|
DEFAULT_BRANCH: main
|
||||||
@@ -19,6 +31,8 @@ jobs:
|
|||||||
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
WORKFLOW_RUN_HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}
|
WORKFLOW_RUN_HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}
|
||||||
WORKFLOW_RUN_HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
|
WORKFLOW_RUN_HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
|
||||||
|
WORKFLOW_RUN_REPO_DEFAULT_BRANCH: ${{ github.event.workflow_run.repository.default_branch }}
|
||||||
|
REPOSITORY_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
||||||
steps:
|
steps:
|
||||||
- name: SSH and deploy
|
- name: SSH and deploy
|
||||||
uses: appleboy/ssh-action@master
|
uses: appleboy/ssh-action@master
|
||||||
|
|||||||
@@ -17,8 +17,23 @@ jobs:
|
|||||||
name: E2E Tests
|
name: E2E Tests
|
||||||
if: ${{ github.event_name == 'workflow_dispatch' ||
|
if: ${{ github.event_name == 'workflow_dispatch' ||
|
||||||
github.event_name == 'push' ||
|
github.event_name == 'push' ||
|
||||||
(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')) }}
|
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' ||
|
||||||
|
(
|
||||||
|
!github.event.workflow_run.head_branch &&
|
||||||
|
(
|
||||||
|
github.event.workflow_run.repository.default_branch == 'main' ||
|
||||||
|
github.event.workflow_run.repository.default_branch == 'refs/heads/main' ||
|
||||||
|
github.event.repository.default_branch == 'main' ||
|
||||||
|
github.event.repository.default_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