From 3d15dd89361b068de3908ec29de13f15f869f528 Mon Sep 17 00:00:00 2001 From: Igor Ignatev Date: Sat, 15 Oct 2022 22:18:26 +0300 Subject: [PATCH 1/3] workflows --- .github/workflows/{cd.yml => ci-tests.yml} | 9 ++- .github/workflows/ci.yml | 35 ------------ .github/workflows/release.yml | 66 ++++++++++++++++++++++ 3 files changed, 72 insertions(+), 38 deletions(-) rename .github/workflows/{cd.yml => ci-tests.yml} (82%) delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/ci-tests.yml similarity index 82% rename from .github/workflows/cd.yml rename to .github/workflows/ci-tests.yml index b87c061..9f25068 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/ci-tests.yml @@ -1,6 +1,3 @@ -# This workflow will install Python dependencies, run tests and lint with a single version of Python -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - name: Python application on: @@ -39,3 +36,9 @@ jobs: python -m pytest env: FLASK_APP: kubelinks_app.__init__ + - name: Build without push + uses: docker/build-push-action@v3 + with: + context: . + push: false + tags: smitkirara/kubelinks:v0.0.${{ github.run_number }}-dev diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 7179bbe..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: ci docker - -on: - pull_request: - types: [closed] - branches: - - 'master' - -jobs: - docker: - if: github.event.pull_request.merged == true - runs-on: ubuntu-latest - steps: - - - name: Checkout - uses: actions/checkout@v3 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v3 - with: - context: . - push: true - tags: smitkirara/kubelinks:0.0.${{ github.run_number }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..4843cfc --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,66 @@ +name: build docker image and release helm chart + +on: + create: + tags: + - v* + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - + name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Build and push + uses: docker/build-push-action@v3 + with: + context: . + push: true + tags: smitkirara/kubelinks:${{ github.ref }} + + release: + permissions: + contents: write + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Configure Git + run: | + git config user.name "$GITHUB_ACTOR" + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + + - name: Update Helm Chart Values + uses: Nextdoor/helm-set-image-tag-action@main + with: + verbose: true + tag: ${{ github.ref }} + values: charts/kubelinks/values.yaml + keys: .image.tag + bump_level: patch + commit_branch: main + + - name: Install Helm + uses: azure/setup-helm@v3 + + - name: Run chart-releaser + uses: helm/chart-releaser-action@v1.4.1 + env: + CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file From 8be1432e9c1c6a066380cfdbc68b317bbad711ec Mon Sep 17 00:00:00 2001 From: Igor Ignatev Date: Sat, 15 Oct 2022 22:22:24 +0300 Subject: [PATCH 2/3] update triggers --- .github/workflows/release.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4843cfc..4ee65e2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,9 @@ name: build docker image and release helm chart on: - create: + push: + branches: + - master tags: - v* @@ -55,7 +57,7 @@ jobs: values: charts/kubelinks/values.yaml keys: .image.tag bump_level: patch - commit_branch: main + commit_branch: master - name: Install Helm uses: azure/setup-helm@v3 From 07741dce21490382a6a1ccc759e44dd0fea73171 Mon Sep 17 00:00:00 2001 From: Igor Ignatev Date: Sat, 15 Oct 2022 22:23:31 +0300 Subject: [PATCH 3/3] add dependency --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4ee65e2..4c28548 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,6 +35,7 @@ jobs: tags: smitkirara/kubelinks:${{ github.ref }} release: + needs: docker permissions: contents: write runs-on: ubuntu-latest