diff --git a/.github/workflows/push_main.yaml b/.github/workflows/ci.yaml similarity index 81% rename from .github/workflows/push_main.yaml rename to .github/workflows/ci.yaml index 1b975272..0f426ff6 100644 --- a/.github/workflows/push_main.yaml +++ b/.github/workflows/ci.yaml @@ -1,4 +1,4 @@ -name: Push (main) +name: CI # When pushing to the "main" branch, we: # * build the rock image @@ -6,9 +6,8 @@ name: Push (main) # * scan the image and upload the artifacts to the repository on: + pull_request: push: - branches: - - main paths: - "rockcraft.yaml" - ".github/workflows/**.yaml" @@ -19,9 +18,11 @@ jobs: uses: ./.github/workflows/build.yaml publish: + if: github.ref == 'refs/heads/main' needs: build uses: ./.github/workflows/publish.yaml scan: + if: github.ref == 'refs/heads/main' needs: publish uses: ./.github/workflows/scan.yaml diff --git a/.github/workflows/push_any.yaml b/.github/workflows/push_any.yaml deleted file mode 100644 index 6e803746..00000000 --- a/.github/workflows/push_any.yaml +++ /dev/null @@ -1,16 +0,0 @@ -name: Push (any) - -# When pushing to any branch other than "main", we: -# * build the rock image - -on: - push: - branches-ignore: - - "main" - paths: - - "rockcraft.yaml" - - ".github/workflows/**.yaml" - -jobs: - build: - uses: ./.github/workflows/build.yaml diff --git a/README.md b/README.md index 77068628..1cdfcaab 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ![Latest Version](https://img.shields.io/badge/dynamic/yaml?url=https%3A%2F%2Fraw.githubusercontent.com%2Fcanonical%2Fkratos-rock%2Fmain%2Frockcraft.yaml&query=%24.version&label=Release&color=red) [![License](https://img.shields.io/github/license/canonical/kratos-rock?label=License)](https://github.com/canonical/kratos-rock/blob/main/LICENSE) -[![Build](https://img.shields.io/github/actions/workflow/status/canonical/kratos-rock/push_main.yaml?label=Build)](https://github.com/canonical/kratos-rock/actions/workflows/push_main.yaml) +[![CI](https://github.com/canonical/kratos-rock/actions/workflows/ci.yaml/badge.svg)](https://github.com/canonical/kratos-rock/actions/workflows/ci.yaml) [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit) [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196.svg)](https://conventionalcommits.org)