diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 9d3a8b5..dfaea52 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -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: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 060e325..c621446 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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