Skip to content

Commit

Permalink
Merge pull request #246 from valerymelou/chore/contentful-github-webhook
Browse files Browse the repository at this point in the history
chore: add possibility to call deploy workflow from Contentful
  • Loading branch information
valerymelou authored Jul 22, 2024
2 parents 9c8994c + bfebe06 commit e1a6d82
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
on:
workflow_call:
repository_dispatch:
types: [publish-event]

jobs:
build:
runs-on: ubuntu-latest
environment: ${{ github.ref == 'refs/heads/master' && 'production' || 'staging' }}
environment: ${{ (github.event.client_payload.env && github.event_name == 'repository_dispatch') && github.event.client_payload.env || (github.ref == 'refs/heads/master' && 'production' || 'staging') }}
env:
VM_CONTENTFUL_SPACE: ${{ secrets.VM_CONTENTFUL_SPACE }}
VM_CONTENTFUL_ACCESS_TOKEN: ${{ secrets.VM_CONTENTFUL_ACCESS_TOKEN }}
VM_CONTENTFUL_ENVIRONMENT: ${{ github.ref == 'refs/heads/master' && 'production' || 'staging' }}
VM_CONTENTFUL_ENVIRONMENT: ${{ (github.event.client_payload.env && github.event_name == 'repository_dispatch') && github.event.client_payload.env || (github.ref == 'refs/heads/master' && 'production' || 'staging') }}
outputs:
ENVIRONMENT: ${{ env.VM_CONTENTFUL_ENVIRONMENT }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
deploy:
if: >
(github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || (github.event.pull_request.base.ref == 'develop' && github.event.pull_request.head.repo.full_name == github.repository))
(github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || (github.event.pull_request.base.ref == 'develop' && github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.user.login == 'valerymelou'))
needs: test
uses: ./.github/workflows/cd.yml
secrets: inherit

0 comments on commit e1a6d82

Please sign in to comment.