diff --git a/.github/workflows/cicd-1-pull-request.yaml b/.github/workflows/cicd-1-pull-request.yaml index 2d84c01e..9fe13290 100644 --- a/.github/workflows/cicd-1-pull-request.yaml +++ b/.github/workflows/cicd-1-pull-request.yaml @@ -3,8 +3,11 @@ name: "CI/CD pull request" # The total recommended execution time for the "CI/CD Pull Request" workflow is around 20 minutes. on: + push: + branches: + - "**" pull_request: - types: [opened, reopened] + types: [opened, reopened, merged] jobs: metadata: @@ -93,7 +96,7 @@ jobs: name: "Build stage" needs: [metadata, test-stage] uses: ./.github/workflows/stage-3-build.yaml - if: needs.metadata.outputs.does_pull_request_exist == 'true' || (github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened')) + if: needs.metadata.outputs.does_pull_request_exist == 'true' || (github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'merged')) with: build_datetime: "${{ needs.metadata.outputs.build_datetime }}" build_timestamp: "${{ needs.metadata.outputs.build_timestamp }}" diff --git a/.github/workflows/cicd-4-main-branch.yml b/.github/workflows/cicd-4-main-branch.yml deleted file mode 100644 index 08d2b329..00000000 --- a/.github/workflows/cicd-4-main-branch.yml +++ /dev/null @@ -1,80 +0,0 @@ -name: 'CI/CD main branch' - -on: - push: - branches: [main] - -jobs: - metadata: - name: 'Set CI/CD metadata' - runs-on: ubuntu-latest - timeout-minutes: 1 - outputs: - build_datetime: ${{ steps.variables.outputs.build_datetime }} - build_timestamp: ${{ steps.variables.outputs.build_timestamp }} - build_epoch: ${{ steps.variables.outputs.build_epoch }} - nodejs_version: ${{ steps.variables.outputs.nodejs_version }} - python_version: ${{ steps.variables.outputs.python_version }} - terraform_version: ${{ steps.variables.outputs.terraform_version }} - version: ${{ steps.variables.outputs.version }} - tag: ${{ steps.variables.outputs.tag }} - steps: - - name: 'Checkout code' - uses: actions/checkout@v5 - - name: 'Set CI/CD variables' - id: variables - run: | - datetime=$(date -u +'%Y-%m-%dT%H:%M:%S%z') - echo "build_datetime=$datetime" >> $GITHUB_OUTPUT - echo "build_timestamp=$(date --date=$datetime -u +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT - echo "build_epoch=$(date --date=$datetime -u +'%s')" >> $GITHUB_OUTPUT - echo "nodejs_version=$(grep "^nodejs" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT - echo "python_version=$(grep "^python" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT - echo "terraform_version=$(grep "^terraform" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT - echo "version=${GITHUB_REF}" - - # Scan the commit - commit-stage: - name: 'Commit stage' - needs: [metadata] - uses: ./.github/workflows/stage-1-commit.yaml - with: - build_datetime: '${{ needs.metadata.outputs.build_datetime }}' - build_timestamp: '${{ needs.metadata.outputs.build_timestamp }}' - build_epoch: '${{ needs.metadata.outputs.build_epoch }}' - nodejs_version: '${{ needs.metadata.outputs.nodejs_version }}' - python_version: '${{ needs.metadata.outputs.python_version }}' - terraform_version: '${{ needs.metadata.outputs.terraform_version }}' - version: '${{ needs.metadata.outputs.version }}' - secrets: inherit - - # Test the integrated code - test-stage: - name: 'Test stage' - needs: [metadata] - uses: ./.github/workflows/stage-2-test.yaml - with: - build_datetime: '${{ needs.metadata.outputs.build_datetime }}' - build_timestamp: '${{ needs.metadata.outputs.build_timestamp }}' - build_epoch: '${{ needs.metadata.outputs.build_epoch }}' - nodejs_version: '${{ needs.metadata.outputs.nodejs_version }}' - python_version: '${{ needs.metadata.outputs.python_version }}' - terraform_version: '${{ needs.metadata.outputs.terraform_version }}' - version: '${{ needs.metadata.outputs.version }}' - secrets: inherit - - # Build the final artefact with the integrated code - build-stage: # Recommended maximum execution time is 3 minutes - name: 'Build stage' - needs: [metadata, commit-stage, test-stage] - uses: ./.github/workflows/stage-3-build.yaml - with: - build_datetime: '${{ needs.metadata.outputs.build_datetime }}' - build_timestamp: '${{ needs.metadata.outputs.build_timestamp }}' - build_epoch: '${{ needs.metadata.outputs.build_epoch }}' - nodejs_version: '${{ needs.metadata.outputs.nodejs_version }}' - python_version: '${{ needs.metadata.outputs.python_version }}' - terraform_version: '${{ needs.metadata.outputs.terraform_version }}' - version: '${{ needs.metadata.outputs.version }}' - commit_sha: '${{ github.sha }}' - secrets: inherit