From b01e193aabd944958aa8fc85ed0cf9d7a3db695f Mon Sep 17 00:00:00 2001 From: Callum Tait <15716903+toast-gear@users.noreply.github.com> Date: Tue, 5 Oct 2021 22:28:05 +0100 Subject: [PATCH] ci: publish chart on chart.yaml changes only (#873) * ci: clean up of workflows in general --- .github/workflows/build-and-release-runners.yml | 2 ++ .../workflows/on-push-master-publish-chart.yml | 16 +++++++++++++++- .github/workflows/release.yml | 2 ++ .github/workflows/test-entrypoint.yaml | 1 + .github/workflows/test.yaml | 13 +++++++++---- .github/workflows/wip.yml | 7 +++++++ CONTRIBUTING.md | 5 +---- 7 files changed, 37 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-and-release-runners.yml b/.github/workflows/build-and-release-runners.yml index b87dc891..11170f91 100644 --- a/.github/workflows/build-and-release-runners.yml +++ b/.github/workflows/build-and-release-runners.yml @@ -7,6 +7,7 @@ on: paths: - 'runner/**' - .github/workflows/build-and-release-runners.yml + - '!**.md' push: branches: - master @@ -17,6 +18,7 @@ on: - runner/Dockerfile.dindrunner - runner/entrypoint.sh - .github/workflows/build-and-release-runners.yml + - '!**.md' env: RUNNER_VERSION: 2.283.3 diff --git a/.github/workflows/on-push-master-publish-chart.yml b/.github/workflows/on-push-master-publish-chart.yml index e164d79d..277a52d3 100644 --- a/.github/workflows/on-push-master-publish-chart.yml +++ b/.github/workflows/on-push-master-publish-chart.yml @@ -79,8 +79,22 @@ jobs: run: ct install --config charts/.ci/ct-config.yaml if: steps.list-changed.outputs.changed == 'true' - publish-chart: + # WARNING: This relies on the latest release being inat the top of the JSON from GitHub and a clean chart.yaml + - name: Check if Chart Publish is Needed + id: publish-chart + run: | + CHART_TEXT=$(curl -fs https://raw.githubusercontent.com/actions-runner-controller/actions-runner-controller/master/charts/actions-runner-controller/Chart.yaml) + NEW_CHART_VERSION=$(echo "$CHART_TEXT" | grep version: | cut -d ' ' -f 2) + RELEASE_LIST=$(curl -fs https://api.github.com/repos/actions-runner-controller/actions-runner-controller/releases | jq .[].tag_name | grep actions-runner-controller | cut -d '"' -f 2 | cut -d '-' -f 4) + LATEST_RELEASED_CHART_VERSION=$(echo $RELEASE_LIST | cut -d ' ' -f 1) + echo "Chart version in master : $NEW_CHART_VERSION" + echo "Latest release chart version : $LATEST_RELEASED_CHART_VERSION" + if [[ $NEW_CHART_VERSION != $LATEST_RELEASED_CHART_VERSION ]]; then + echo "::set-output name=publish::true" + fi + publish-chart: + if: steps.publish-chart.outputs.publish == 'true' runs-on: ubuntu-latest needs: lint-chart diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c5c4d409..7940cd57 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,3 +1,5 @@ +name: Publish Controller Image + on: release: types: [published] diff --git a/.github/workflows/test-entrypoint.yaml b/.github/workflows/test-entrypoint.yaml index 393d8316..6bd70254 100644 --- a/.github/workflows/test-entrypoint.yaml +++ b/.github/workflows/test-entrypoint.yaml @@ -7,6 +7,7 @@ on: paths: - 'runner/**' - 'test/entrypoint/**' + - '!**.md' jobs: test: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 4716dca6..ec1940dc 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -5,10 +5,15 @@ on: branches: - master paths-ignore: - - 'runner/**' - - .github/workflows/build-and-release-runners.yml - - '*.md' - - '.gitignore' + - .github/workflows/build-and-release-runners.yml + - .github/workflows/on-push-lint-charts.yml + - .github/workflows/on-push-master-publish-chart.yml + - .github/workflows/release.yml + - .github/workflows/test-entrypoint.yml + - .github/workflows/wip.yml + - 'runner/**' + - '**.md' + - '.gitignore' jobs: test: diff --git a/.github/workflows/wip.yml b/.github/workflows/wip.yml index 02532c53..613bdcf6 100644 --- a/.github/workflows/wip.yml +++ b/.github/workflows/wip.yml @@ -1,8 +1,15 @@ +name: Publish Canary Image + on: push: branches: - master paths-ignore: + - .github/workflows/build-and-release-runners.yml + - .github/workflows/on-push-lint-charts.yml + - .github/workflows/on-push-master-publish-chart.yml + - .github/workflows/release.yml + - .github/workflows/test-entrypoint.yml - "runner/**" - "**.md" - ".gitignore" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ab454258..4f6210bc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -136,7 +136,4 @@ GINKGO_FOCUS='[It] should create a new Runner resource from the specified templa #### Helm Version Bumps -**Chart Version :** When bumping the chart version follow semantic versioning https://semver.org/
-**App Version :** When bumping the app version you will also need to bump the chart version too. Again, follow semantic versioning when bumping the chart. - -To determine if you need to bump the MAJOR, MINOR or PATCH versions you will need to review the changes between the previous app version and the new app version and / or ask for a maintainer to advise. +In general we ask you not to bump the version in your PR, the maintainers in general manage the publishing of a new chart.