Skip to content

Commit

Permalink
Merge pull request #1021 from frontegg/FR-13416-trigger-e2e-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rotemzif1 authored Oct 16, 2023
2 parents b60aa75 + 30457a4 commit a250687
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/publish-prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,44 @@ jobs:
env:
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

- name: Publish Pre-Release version to NPM
id: publish_pre_release_version
run: |
version=$(node -p 'require("./lerna.json").version')
echo "::set-output name=LIB_VERSION::${version}"
echo "Publishing DEV version - v${version}-alpha.${{ github.run_id }}"
make move-package-json-to-dist
make prerelease-version-upgrade-${version}-alpha.${{ github.run_id }}
make pretty
git add .
git commit -m "chore: prelrease version"
make publish-packages-next
env:
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

- name: Trigger E2E test workflow
uses: actions/github-script@v5
env:
PR_REF: '${{ steps.cpr.outputs.pull-request-head-sha }}'
PR_VERSION: '${{ steps.publish_pre_release_version.outputs.LIB_VERSION }}-alpha.${{ github.run_id }}'
with:
github-token: ${{ secrets.GH_REPOSITORY_ADMIN_TOKEN }}
script: |
const sha = process.env.PR_REF;
const repo = context.payload.repository.name
const owner = context.payload.repository.organization
const data = await github.rest.actions.createWorkflowDispatch({
owner: context.payload.repository.organization,
repo: context.payload.repository.name,
workflow_id: 'trigger-e2e-test.yml',
ref: process.env.PR_REF,
inputs: {
version: process.env.PR_VERSION,
repo,
sha
}
});
- name : Notify Slack on alpha version deployment
uses : rtCamp/action-slack-notify@v2
env :
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/trigger-e2e-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Trigger E2E tests Workflow

on:
workflow_dispatch:
inputs:
version:
description: 'Version'
required: true
dispatch_id:
description: 'Dispatch Id (repo/sha)'
required: true

jobs:
trigger_e2e_tests:
name: "Trigger E2E tests Workflow"
runs-on: ubuntu-latest
steps:
- name: "Trigger E2E tests"
uses: actions/github-script@v5
env:
version: ${{ inputs.version }}
dispatch_id: ${{ inputs.dispatch_id }}
with:
github-token: ${{ secrets.GH_REPOSITORY_ADMIN_TOKEN }}
script: |
const {repo, sha, version} = process.env;
const owner = context.payload.repository.organization
const e2eRepo = 'e2e-system-tests'
const workflow_id = 'frontegg-react-e2e-tests.yml'
const context = `${owner}/${e2eRepo}`
const dispatch_id = `${repo}/${sha}`
const res = await github.rest.repos.createCommitStatus({
context, owner, repo, sha,
state: 'pending',
description: 'Dispatching E2E tests...',
});
const data = await github.rest.actions.createWorkflowDispatch({
owner,
repo:e2eRepo,
workflow_id,
ref: 'main',
inputs: {
version,
dispatch_id,
}
});

0 comments on commit a250687

Please sign in to comment.