diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index e1d1b24..9937ed4 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -27,21 +27,46 @@ jobs: push: true secrets: inherit - deploy_to_dev: - name: Deploy to dev + deploy_to_dev_on_workflow_dispatch: + name: Deploy to dev on manual workflow dispatch + if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'development' uses: ./.github/workflows/deploy.yml - needs: build + needs: + - build + with: + environment: development + version: ${{ needs.build.outputs.version }} + secrets: inherit + + deploy_to_prod_on_workflow_dispatch: + name: Deploy to prod on manual workflow dispatch + if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'production' && github.event.inputs.branch == 'main' + uses: ./.github/workflows/deploy.yml + needs: + - build + with: + environment: production + version: ${{ needs.build.outputs.version }} + secrets: inherit + + deploy_to_dev_on_push_to_main: + name: Deploy to dev on push to main + if: github.event_name == 'pull_request' && github.base_ref == 'refs/heads/main' && github.event.action == 'closed' && github.event.pull_request.merged == true + uses: ./.github/workflows/deploy.yml + needs: + - build with: environment: development version: ${{ needs.build.outputs.version }} secrets: inherit - deploy_to_prod: - name: Deploy to prod + deploy_to_prod_on_push_to_main: + name: Deploy to prod on push to main + if: github.event_name == 'pull_request' && github.base_ref == 'refs/heads/main' && github.event.action == 'closed' && github.event.pull_request.merged == true uses: ./.github/workflows/deploy.yml needs: - build - - deploy_to_dev # wait for the deploy_to_dev job to complete + - deploy_to_dev_on_push_to_main # wait for the deploy_to_dev job to complete with: environment: production version: ${{ needs.build.outputs.version }}