From d5cba6dc815444d89897dd69f4a88c889a1bd37d Mon Sep 17 00:00:00 2001 From: eveleighoj <35256612+eveleighoj@users.noreply.github.com> Date: Wed, 30 Jul 2025 15:46:30 +0100 Subject: [PATCH 1/5] adjust names --- .github/workflows/featureDeploy.yml | 39 --------------------- .github/workflows/{base.yml => publish.yml} | 14 ++++---- .github/workflows/security-scan.yml | 2 +- .github/workflows/test.yml | 12 ++++--- 4 files changed, 14 insertions(+), 53 deletions(-) delete mode 100644 .github/workflows/featureDeploy.yml rename .github/workflows/{base.yml => publish.yml} (76%) diff --git a/.github/workflows/featureDeploy.yml b/.github/workflows/featureDeploy.yml deleted file mode 100644 index 7e77d25c8..000000000 --- a/.github/workflows/featureDeploy.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Deploy branch -run-name: Manual deploy to ${{ inputs.environment || 'development' }} by @${{ github.actor }} - -on: - workflow_dispatch: - inputs: - environment: - type: environment - description: The environment to deploy to. - -jobs: - detect-environments: - runs-on: ubuntu-latest - outputs: - environments: ${{ steps.environments.outputs.result }} - steps: - - uses: actions/github-script@v7 - id: environments - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - result-encoding: json - script: | - if (context.payload?.inputs?.environment) return [context.payload?.inputs?.environment]; - const {data: {environments}} = - await github.request(`GET /repos/${process.env.GITHUB_REPOSITORY}/environments`); - return environments.map(e => e.name) - - deploy-changes: - needs: [detect-environments] - strategy: - matrix: - environment: ${{ fromJSON(needs.detect-environments.outputs.environments) }} - if: ${{ inputs.environment != 'production' }} - uses: ./.github/workflows/deploy.yml - with: - environment: '${{ inputs.environment }}' - secrets: inherit - - diff --git a/.github/workflows/base.yml b/.github/workflows/publish.yml similarity index 76% rename from .github/workflows/base.yml rename to .github/workflows/publish.yml index 28b9937e7..5ef438530 100644 --- a/.github/workflows/base.yml +++ b/.github/workflows/publish.yml @@ -1,8 +1,9 @@ -name: Code change pipeline -run-name: Code change pipeline to ${{ inputs.environment || 'development' }} by @${{ github.actor }} +name: Publish +run-name: Publish - ${{ github.head_ref || github.ref_name }} to ${{ inputs.environment || 'All' }} by @${{ github.actor }} triggered via ${{ github.event_name }} on: push: + branches: [main] workflow_dispatch: inputs: environment: @@ -32,15 +33,12 @@ jobs: await github.request(`GET /repos/${process.env.GITHUB_REPOSITORY}/environments`); return environments.map(e => e.name) - deploy-changes: + publish-image: needs: [run-tests, detect-environments] strategy: matrix: - environment: ['production', 'staging'] - if: ${{ github.ref_name == 'main'}} + environment: ${{ fromJSON(needs.detect-environments.outputs.environments) }} uses: ./.github/workflows/deploy.yml with: environment: '${{ matrix.environment }}' - secrets: inherit - - + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/security-scan.yml b/.github/workflows/security-scan.yml index 22f77bc11..3956c0879 100755 --- a/.github/workflows/security-scan.yml +++ b/.github/workflows/security-scan.yml @@ -1,4 +1,4 @@ -name: security-scan +name: Security Scan on: schedule: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 98ad87dd1..d1939a359 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,14 +1,14 @@ name: Test -run-name: Test run triggered by @${{ github.actor }} +run-name: Test - ${{ github.head_ref || github.ref_name }} by @${{ github.actor }} triggered via ${{ github.event_name }} on: workflow_call: inputs: environment: - description: What environment should the app be deployed to? + description: Which environment's containers should be used required: true - default: 'development' - type: string + default: development + type: environment secrets: DEPLOY_DOCKER_REPOSITORY: required: true @@ -16,7 +16,9 @@ on: required: true DEPLOY_AWS_SECRET_ACCESS_KEY: required: true - + push: + branches-ignore: [main] + jobs: test: runs-on: ubuntu-latest From 4ba69b7a839b9567f3c1685abf5a333a7a78a971 Mon Sep 17 00:00:00 2001 From: eveleighoj <35256612+eveleighoj@users.noreply.github.com> Date: Thu, 31 Jul 2025 10:35:00 +0100 Subject: [PATCH 2/5] correct workflow call inputs --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d1939a359..1d4bf3a5a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,10 +5,10 @@ on: workflow_call: inputs: environment: - description: Which environment's containers should be used + description: Which environment's containers should be used? required: true - default: development - type: environment + default: 'development' + type: string secrets: DEPLOY_DOCKER_REPOSITORY: required: true From 3c0eb3965048ae33224ee262feb2629bbf7983ff Mon Sep 17 00:00:00 2001 From: eveleighoj <35256612+eveleighoj@users.noreply.github.com> Date: Fri, 1 Aug 2025 11:20:21 +0100 Subject: [PATCH 3/5] remove unnessary parameter --- .github/workflows/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1d4bf3a5a..6e94472e2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,7 +6,6 @@ on: inputs: environment: description: Which environment's containers should be used? - required: true default: 'development' type: string secrets: From f7746e12a5fa77fb70c9f4ad7a31cd1ee40ebc21 Mon Sep 17 00:00:00 2001 From: eveleighoj <35256612+eveleighoj@users.noreply.github.com> Date: Fri, 1 Aug 2025 12:07:18 +0100 Subject: [PATCH 4/5] linting --- .github/workflows/publish.yml | 2 +- .github/workflows/test.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5ef438530..241a20747 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,5 +1,5 @@ name: Publish -run-name: Publish - ${{ github.head_ref || github.ref_name }} to ${{ inputs.environment || 'All' }} by @${{ github.actor }} triggered via ${{ github.event_name }} +run-name: Publish - ${{ github.head_ref || github.ref_name }} to ${{ inputs.environment || 'All' }} by @${{ github.actor }} triggered via ${{ github.event_name }} on: push: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6e94472e2..b1ada83fc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,7 +5,7 @@ on: workflow_call: inputs: environment: - description: Which environment's containers should be used? + description: Which environment's containers to use for testing default: 'development' type: string secrets: @@ -17,11 +17,11 @@ on: required: true push: branches-ignore: [main] - + jobs: test: runs-on: ubuntu-latest - environment: development + environment: ${{ inputs.environment || development }} env: DOCKER_REPO: ${{ secrets.DEPLOY_DOCKER_REPOSITORY }} steps: From 3881aa169811e39c31152abe987a0d939ce80eaa Mon Sep 17 00:00:00 2001 From: eveleighoj <35256612+eveleighoj@users.noreply.github.com> Date: Fri, 1 Aug 2025 15:19:51 +0100 Subject: [PATCH 5/5] give environment as a string --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b1ada83fc..5e8c8806e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,7 +21,7 @@ on: jobs: test: runs-on: ubuntu-latest - environment: ${{ inputs.environment || development }} + environment: ${{ inputs.environment || 'development' }} env: DOCKER_REPO: ${{ secrets.DEPLOY_DOCKER_REPOSITORY }} steps: