From 4c6ed69f90418f31f3049104d0db7e3de125230a Mon Sep 17 00:00:00 2001 From: Jhony Lucas Date: Fri, 13 Sep 2024 09:02:44 -0300 Subject: [PATCH 1/2] feat: add branch filtering to deployment workflows --- .github/workflows/deploy-dev.yaml | 1 + .github/workflows/deploy-staging.yaml | 2 +- .github/workflows/release-dev.yaml | 10 ++++++++-- .github/workflows/release-prod.yaml | 11 ++++++++++- .github/workflows/release-staging.yaml | 8 ++++++++ 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy-dev.yaml b/.github/workflows/deploy-dev.yaml index de729bec..06816edb 100644 --- a/.github/workflows/deploy-dev.yaml +++ b/.github/workflows/deploy-dev.yaml @@ -3,6 +3,7 @@ name: Deploy (Development) on: workflow_run: workflows: [Release Image (Development)] + branches: [dev] types: [completed] workflow_dispatch: jobs: diff --git a/.github/workflows/deploy-staging.yaml b/.github/workflows/deploy-staging.yaml index 294c6244..d6b90d7a 100644 --- a/.github/workflows/deploy-staging.yaml +++ b/.github/workflows/deploy-staging.yaml @@ -3,7 +3,7 @@ name: Deploy (Staging) on: workflow_run: workflows: [Release Image (Staging)] - branches: [main] + branches: [staging] types: [completed] workflow_dispatch: jobs: diff --git a/.github/workflows/release-dev.yaml b/.github/workflows/release-dev.yaml index 08e92851..db281dc1 100644 --- a/.github/workflows/release-dev.yaml +++ b/.github/workflows/release-dev.yaml @@ -1,9 +1,15 @@ --- name: Release Image (Development) on: - pull_request: - types: [labeled] + push: + branches: + - dev workflow_dispatch: + inputs: + branch: + description: 'Branch to deploy (must be dev)' + required: true + default: 'dev' jobs: release-docker: name: Release Image diff --git a/.github/workflows/release-prod.yaml b/.github/workflows/release-prod.yaml index 9a23c171..eae18c3c 100644 --- a/.github/workflows/release-prod.yaml +++ b/.github/workflows/release-prod.yaml @@ -1,6 +1,15 @@ --- name: Release Image (Production) -on: workflow_dispatch +on: + push: + branches: + - main + workflow_dispatch: + inputs: + branch: + description: 'Branch to deploy (must be main)' + required: true + default: 'main' jobs: release-docker: name: Release Image diff --git a/.github/workflows/release-staging.yaml b/.github/workflows/release-staging.yaml index 179b3be7..8b08b3eb 100644 --- a/.github/workflows/release-staging.yaml +++ b/.github/workflows/release-staging.yaml @@ -1,7 +1,15 @@ --- name: Release Image (Staging) on: + push: + branches: + - staging workflow_dispatch: + inputs: + branch: + description: 'Branch to deploy (must be staging)' + required: true + default: 'staging' jobs: release-docker: name: Release Image From a82ce8be78f54899c98ea134e4df77ba9137de46 Mon Sep 17 00:00:00 2001 From: Jhony Lucas Date: Fri, 13 Sep 2024 09:12:35 -0300 Subject: [PATCH 2/2] refactor: remove redundant workflow_dispatch inputs --- .github/workflows/release-dev.yaml | 6 ------ .github/workflows/release-prod.yaml | 6 ------ .github/workflows/release-staging.yaml | 6 ------ 3 files changed, 18 deletions(-) diff --git a/.github/workflows/release-dev.yaml b/.github/workflows/release-dev.yaml index db281dc1..25092332 100644 --- a/.github/workflows/release-dev.yaml +++ b/.github/workflows/release-dev.yaml @@ -4,12 +4,6 @@ on: push: branches: - dev - workflow_dispatch: - inputs: - branch: - description: 'Branch to deploy (must be dev)' - required: true - default: 'dev' jobs: release-docker: name: Release Image diff --git a/.github/workflows/release-prod.yaml b/.github/workflows/release-prod.yaml index eae18c3c..2e856aba 100644 --- a/.github/workflows/release-prod.yaml +++ b/.github/workflows/release-prod.yaml @@ -4,12 +4,6 @@ on: push: branches: - main - workflow_dispatch: - inputs: - branch: - description: 'Branch to deploy (must be main)' - required: true - default: 'main' jobs: release-docker: name: Release Image diff --git a/.github/workflows/release-staging.yaml b/.github/workflows/release-staging.yaml index 8b08b3eb..0a64e5da 100644 --- a/.github/workflows/release-staging.yaml +++ b/.github/workflows/release-staging.yaml @@ -4,12 +4,6 @@ on: push: branches: - staging - workflow_dispatch: - inputs: - branch: - description: 'Branch to deploy (must be staging)' - required: true - default: 'staging' jobs: release-docker: name: Release Image