From 8682c6f09d4d358bea87926aacdc02739ca85873 Mon Sep 17 00:00:00 2001 From: Niall Byrne <9848926+niall-byrne@users.noreply.github.com> Date: Sat, 18 Nov 2023 05:11:59 -0500 Subject: [PATCH] ci(GITHUB): workflow for tagged containers --- .github/workflows/workflow-push.yml | 57 +++++++++++++++++++---------- 1 file changed, 37 insertions(+), 20 deletions(-) diff --git a/.github/workflows/workflow-push.yml b/.github/workflows/workflow-push.yml index 3017d0d..9fb63be 100644 --- a/.github/workflows/workflow-push.yml +++ b/.github/workflows/workflow-push.yml @@ -203,7 +203,6 @@ jobs: VERBOSE_NOTIFICATIONS: ${{ fromJSON(needs.configuration.outputs.JSON_FILE_DATA).ci_verbose_notifications }} scan_container_aws: - if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' permissions: security-events: write needs: [commit_lint, commit_spell_check, configuration, docker_container_lint, json_schema_lint, markdown_links, markdown_lint, markdown_spelling, pre-commit_hooks, security, shell_lint, start, toml_lint, workflow_lint, yaml_lint] @@ -218,7 +217,6 @@ jobs: VERBOSE_NOTIFICATIONS: ${{ fromJSON(needs.configuration.outputs.JSON_FILE_DATA).ci_verbose_notifications }} scan_container_cloudflare: - if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' permissions: security-events: write needs: [commit_lint, commit_spell_check, configuration, docker_container_lint, json_schema_lint, markdown_links, markdown_lint, markdown_spelling, pre-commit_hooks, security, shell_lint, start, toml_lint, workflow_lint, yaml_lint] @@ -233,8 +231,7 @@ jobs: VERBOSE_NOTIFICATIONS: ${{ fromJSON(needs.configuration.outputs.JSON_FILE_DATA).ci_verbose_notifications }} push_container_aws: - if: github.ref == 'refs/heads/master' - needs: [configuration, scan_container_aws] + needs: [scan_container_aws] permissions: packages: write secrets: @@ -246,13 +243,11 @@ jobs: BUILD_ARGS: | PROVIDER=aws IMAGE_NAME: "docker.io/niallbyrne/smtp-aws" - IMAGE_LATEST: true REGISTRY: "docker.io" VERBOSE_NOTIFICATIONS: true push_container_cloudflare: - if: github.ref == 'refs/heads/master' - needs: [configuration, scan_container_cloudflare] + needs: [scan_container_cloudflare] permissions: packages: write secrets: @@ -264,7 +259,6 @@ jobs: BUILD_ARGS: | PROVIDER=cloudflare IMAGE_NAME: "docker.io/niallbyrne/smtp-cloudflare" - IMAGE_LATEST: true REGISTRY: "docker.io" VERBOSE_NOTIFICATIONS: true @@ -278,19 +272,43 @@ jobs: with: JSON_APPENDED_CONTENT: ${{ toJSON(fromJSON(needs.configuration.outputs.JSON_FILE_DATA).ci_extra_release_content) }} - success_master: - if: github.ref == 'refs/heads/master' - needs: [push_container_aws, push_container_cloudflare] + release_container_aws: + needs: [create_release] + permissions: + packages: write secrets: + REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }} + REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - uses: cicd-tools-org/cicd-tools/.github/workflows/job-00-generic-notification.yml@master + uses: cicd-tools-org/cicd-tools/.github/workflows/job-99-container-push_release.yml@master with: - NOTIFICATION_EMOJI: ":checkered_flag:" - NOTIFICATION_MESSAGE: "Workflow has completed successfully!" + BUILD_ARGS: | + PROVIDER=aws + IMAGE_NAME: "docker.io/niallbyrne/smtp-aws" + IMAGE_LATEST: true + REGISTRY: "docker.io" + VERBOSE_NOTIFICATIONS: true - success_dev: - if: github.ref == 'refs/heads/dev' - needs: [scan_container_aws, scan_container_cloudflare] + release_container_cloudflare: + needs: [create_release] + permissions: + packages: write + secrets: + REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }} + REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + uses: cicd-tools-org/cicd-tools/.github/workflows/job-99-container-push_release.yml@master + with: + BUILD_ARGS: | + PROVIDER=cloudflare + IMAGE_NAME: "docker.io/niallbyrne/smtp-cloudflare" + IMAGE_LATEST: true + REGISTRY: "docker.io" + VERBOSE_NOTIFICATIONS: true + + success_branches: + if: contains(github.ref, 'refs/heads') + needs: [push_container_aws, push_container_cloudflare] secrets: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} uses: cicd-tools-org/cicd-tools/.github/workflows/job-00-generic-notification.yml@master @@ -298,9 +316,8 @@ jobs: NOTIFICATION_EMOJI: ":checkered_flag:" NOTIFICATION_MESSAGE: "Workflow has completed successfully!" - success_other: - if: github.ref != 'refs/heads/master' && github.ref != 'refs/heads/dev' - needs: [commit_lint, commit_spell_check, configuration, docker_container_lint, json_schema_lint, markdown_links, markdown_lint, markdown_spelling, pre-commit_hooks, security, shell_lint, start, toml_lint, workflow_lint, yaml_lint] + success_tags: + needs: [release_container_aws, release_container_cloudflare] secrets: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} uses: cicd-tools-org/cicd-tools/.github/workflows/job-00-generic-notification.yml@master