Skip to content

Commit

Permalink
testing success workflow again
Browse files Browse the repository at this point in the history
  • Loading branch information
gigabite-pro committed Aug 9, 2024
1 parent 42fc623 commit dffa535
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,17 @@ name: Deploy
on:
workflow_run:
workflows: ["Run Tests"]
branches: [main]
branch:
- main
types:
- completed

jobs:
deploy:
name: "Deploy to VPS"
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
if: ${{ github.event.inputs.tests_failed == 'false' }}
steps:
- name: Check Test Conclusion
if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion != 'success' }}
run: echo "Skipping deployment because tests failed." && exit 1

- name: Configure SSH
run: |
mkdir -p ~/.ssh
Expand Down Expand Up @@ -46,7 +43,8 @@ jobs:
failure-notification:
name: "Notify Failure"
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion != 'success' }}
needs: deploy
if: ${{ needs.deploy.result == 'failure' || github.event.inputs.tests_failed == 'true' }}
steps:
- name: Send Discord Notification on Failure
run: curl -s -X POST "${{ secrets.DISCORD_WEBHOOK }}" -d "content=🚨 Deployment Failed"
17 changes: 17 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,20 @@ jobs:

- name: Run Tests
run: ./run_test.sh
deploy-trigger:
runs-on: ubuntu-latest
needs: run-tests
steps:
- name: Trigger Deploy Workflow
uses: actions/github-script@v6
with:
script: |
github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: "deploy.yml",
ref: context.ref,
inputs: {
tests_failed: ${{ job.status == 'failure' }}
}
})

0 comments on commit dffa535

Please sign in to comment.